定制 flxlabs/silverstripe-pagesections 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flxlabs/silverstripe-pagesections

最新稳定版本:2.0.9-beta

Composer 安装命令:

composer require flxlabs/silverstripe-pagesections

包简介

Adds configurable page sections and elements to your SilverStripe project.

README 文档

README

Elemental alternative for configurable page sections and elements.

Introduction

This module provides page sections for SilverStripe 4.x projects. Page sections are areas on a page where CMS users can add their own content in a structured way. Pages can have none, one or more page sections attached to them. Each page section is made up of various page elements, which themselves can or cannot have other page elements as children.

Installation

composer require flxlabs/silverstripe-pagesections

Add the extension to the DataObject that should contain a PageSection:

Page:
  extensions:
    - PageSectionsExtension
  

By default the DataObject will have a PageSection called Main. To add additional sections, or change the name of the default section, specify them in the page_sections key.

Page:
  extensions:
    - PageSectionsExtension
  page_sections:
    - Main
    - Aside

Make sure to run dev/build and flush.

Usage

Defining an element:

<?php
class TextElement extends FLXLabs\PageSections\PageElement
{
  public static $singular_name = 'Text';
  public static $plural_name = 'Texts';

  private static $db = [
    'Content' => 'HTMLText',
  ];

  // Page elements can have other page elements as children.
  // Use this method to restrict allowed childre.
  public function getAllowedPageElements()
  {
    return [
      // YourElement::class
    ];
  }

  // This will be used to preview the content in the CMS editor
  public function getGridFieldPreview()
  {
      return $this->dbObject('Content')->Summary();
  }
}

To render an element, create a Template. To render a page section use the RenderPageElements method exposed by the PageSectionsExtension:

<div>
  $RenderPageSection('SectionName')
</div>

统计信息

  • 总下载量: 2.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固