Skip to content

Commit

Permalink
Merge pull request #135 from SilbinaryWolf/feature-versionedconfig
Browse files Browse the repository at this point in the history
feat(BetterButtonDataObject): Add config to disable versioned BetterButtons controls
  • Loading branch information
Aaron Carlino authored Jun 30, 2016
2 parents 5a34cda + 42d6270 commit c976950
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion code/extensions/BetterButtonDataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ class BetterButtonDataObject extends DataExtension {
* @var bool
*/
private static $better_buttons_enabled = true;

/**
* Enable versioned controls like 'Save & Publish' for DataObjects
* with 'Versioned' extension.
*
* Disable this for records where you want a parent DataObject to control the
* published/unpublished state of its children. ie. User Defined Forms 3.0+.
*
* @config
* @var bool
*/
private static $better_buttons_versioned_enabled = true;

/**
* Gets the default actions for all DataObjects. Can be overloaded in subclasses
Expand Down Expand Up @@ -184,7 +196,8 @@ protected function createButtonGroup($groupName) {
* @return boolean
*/
public function checkVersioned() {
return $this->owner->hasExtension('Versioned') &&
return $this->owner->config()->better_buttons_versioned_enabled &&
$this->owner->hasExtension('Versioned') &&
count($this->owner->getVersionedStages()) > 1;
}

Expand Down

0 comments on commit c976950

Please sign in to comment.