bluehousegroup/silverstripe-data-object-version-viewer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bluehousegroup/silverstripe-data-object-version-viewer

最新稳定版本:0.1

Composer 安装命令:

composer require bluehousegroup/silverstripe-data-object-version-viewer

包简介

Allows viewing of version history for data objects inside of the SilverStripe CMS

README 文档

README

Screenshot

Install with Composer

composer require bluehousegroup/silverstripe-data-object-version-viewer

Usage

  • Extend silverstripe-versioneddataobjects to add a 'History' button to a GridField or ModelAdmin
  • View, revert to, and publish a previous versions of a data object

Example code

The implementation is very similar to the versioneddataobjects module, on which this module depends.

Within your DataObject class

class Slice extends DataObject
{
	private static $db = [
		'Content' => 'Text'
	];

	private static $has_one = [
		'Parent' => 'SiteTree'
	];

	private static $extensions = [
		'Heyday\VersionedDataObjects\VersionedDataObject'
	];
}

To use VersionedDataObject records in a GridField, GridFieldDetailForm needs to be replaced with VersionedRevertDODetailsForm:

// ...

public function getCMSFields()
{
	$fields = parent::getCMSFields();

	$fields->addFieldToTab(
		'Root.Slices',
		new GridField(
			'Slices',
			'Slices',
			$this->Slices(),
			$config = GridFieldConfig_RelationEditor::create()
		)
	);

	$config->removeComponentsByType('GridFieldDetailForm');
	$config->addComponent(new VersionedRevertDODetailsForm());

	return $fields;
}

// ...

Versioned DataObjects in a ModelAdmin

class SliceAdmin extends VersionedRevertModelAdmin
{
	private static $menu_title = 'Slices';

	private static $url_segment = 'slice';

	private static $managed_models = [
		'Slice'
	];
}

Notes

This module is intended to be compatible with the betterbuttons module. Toward that end, it removes the betterbuttons's Versioning button group in order to keep in tact the buttons added by the versiondataobjects plug-in. This change affects only the forms configured with the VersionedRevertDODetailsForm extension.

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 18
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固