Skip to content

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

License

Notifications You must be signed in to change notification settings

helpfulrobot/nathancox-versionedgridrows

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SilverStripe VersionedGridRows

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

screenshot

Maintainer Contacts

Nathan Cox ([email protected])

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 86.7%
  • CSS 13.3%