guysartorelli/silverstripe-gridfield-preview
最新稳定版本:3.0.0
Composer 安装命令:
composer require guysartorelli/silverstripe-gridfield-preview
包简介
Standalone silverstripe GridField component for previewing records directly from the GridField
README 文档
README
A stand-alone GridField component that enables previewing records directly from a GridField.
Install
composer require guysartorelli/silverstripe-gridfield-preview
CMS User Usage
Click the preview button in the gridfield. This will automatically open the preview panel (in split mode if your screen is wide enough, or in preview mode otherwise) with the preview set to the record you clicked.
Developer Usage
Directly inn a ModelAdmin
The easiest way to use this module is to add PreviewableModelAdminExtension as an extension for your ModelAdmin subclass. By default this will add a preview button to the gridfield for all tabs that have CMSPreviewable models.
MyApp\Admin\MyModelAdmin: extensions: - GuySartorelli\GridFieldPreview\PreviewableModelAdminExtension
You can also configure this to only add the component for specific model classes:
MyApp\Admin\MyModelAdmin: extensions: - GuySartorelli\GridFieldPreview\PreviewableModelAdminExtension gridfield_previewable_classes: - MyApp\Model\MyPreviewableModel
In literally any other GridField
You can add the GridFieldPreviewButton GridField component to literally any GridField, even one that belongs to a DataObject which has its own preview!
use GuySartorelli\GridFieldPreview\GridFieldPreviewButton; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig_RecordViewer; //... public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', GridField::create( 'SomethingPreviewable', 'Something Previewable', MyPreviewableDataObject::get(), $config = GridFieldConfig_RecordViewer::create() )); // Here's the important part - add the GridFieldPreviewButton component! $config->addComponent(GridFieldPreviewButton::create()); return $fields; }
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-09-05

