nathancox/versionedgridrows

A SilverStripe extension to mark gridfield rows for versioned objects as draft or modified

v1.1.0 2017-07-25 04:54 UTC

This package is not auto-updated.

Last update: 2024-12-14 02:05:15 UTC


README

This module extends GridField to add some styles and labels for showing the published state of versioned objects.

screenshot

Maintainer Contacts

Nathan Cox (me@nathan.net.nz)

Requirements

  • SilverStripe 3.1+

Documentation

GitHub

Installation Instructions

With composer:

composer require nathancox/versionedgridrows

Usage Overview

Configuration via config.yml:

VersionedGridRows:
  mode: 'component'			# can be "component", "config" or "always"
  show_published: false		# set to true to show a flag on published items as well

Options for the mode setting:

mode: 'component'

Only add row styles to GridFields with the VersionGridRows component added to them. This is done like any other component:

$gridFieldConfig->addComponent(new VersionedGridRows('Title'));

The constructor argument ("Title") specifies the name of the column the "draft" or "modified" flags will be appended to. Leave blank to not automatically append the flags.

mode: 'always'

Styles will be added to all GridFields that managed versioned objects. If you want to add flags you need to do it manually with something like this:

$summary_fields = array(
	'VersionedTitle' => 'Title'
);

...

public function VersionedTitle()
{
	return VersionedGridRows::get_column_content($this, $this->Title);
}

mode: 'config'

Specify a list of classes that styles will be added to.

VersionedGridRow:
  mode: 'config'
  classes:
  	- Page
  	- StaffMember
  	- HomepageSlide

You will have to add version status flags manually as shown above.

Known Issues

Issue Tracker