micschk / silverstripe-rightsidebar
允许在CMS中添加一个右侧边栏,用于存放当前编辑记录的选项/字段
2.0
2018-07-09 08:27 UTC
Requires
- silverstripe/cms: ~4.0
- silverstripe/framework: ~4.0
- silverstripe/vendor-plugin: ^1.0
This package is not auto-updated.
Last update: 2024-09-14 17:42:45 UTC
README
要求
- SilverStripe CMS & Framework 4+
概述
允许在CMS中添加一个右侧边栏,用于存放当前编辑记录的选项/字段。从Silverstripe博客模块中抽象出来,也可用于其他页面(由ao. Michael Strong/Silverstripe开发的博客模块)
RightSidebar的行为类似于标签页(类似于它扩展的CompositeField)。
在class声明之前添加use
use Restruct\RightSidebar\RightSidebar;
用法(在getCMSfields中)
$fields->addFieldsToTab('Root.Main', RightSidebar::create('Options')); $fields->addFieldsToTab('Root.Main.Options', array( $publishDate = DatetimeField::create("PublishDate", "Publish Date"), TextField::create('Author') )); // Add to Main tab (fixed width) and render an outer template to deal with our custom layout $fields->addFieldsToTab('Root.Main', RightSidebar::create('Options')); $fields->fieldByName('Root')->setTemplate('Restruct\RightSidebar\Forms\RightSidebarInner'); // OR: Add it full-screen (collapsible) and render an outer template to deal with our custom layout $fields->insertBefore(RightSidebar::create('Options'), 'Root'); $fields->fieldByName('Root')->setTemplate('Restruct\RightSidebar\Forms\RightSidebar');