Source of file BlockEnhancements_SiteTreeExt.php
Size: 0,853 Bytes - Last Modified: 2021-12-23T10:04:34+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/BlockEnhancements_SiteTreeExt.php
123456789101112131415161718192021222324252627 | <?php class BlockEnhancements_SiteTreeExt extends SiteTreeExtension { public function updateCMSActions(FieldList $actions) { if(!$this->owner->Blocks()->count()) return; $actions->fieldByName('MajorActions')->push( $publish = FormAction::create('publishPageAndBlocks', 'Published (+Blocks)') ->setAttribute('data-icon', 'accept') ->setAttribute('data-icon-alternate', 'disk') ->setAttribute('data-text-alternate', 'Save & publish (+Blocks)') ); // Set up the initial state of the button to reflect the state of the blocks foreach ($this->owner->Blocks() as $block) { if ($block->stagesDiffer('Stage', 'Live')) { $publish->addExtraClass('ss-ui-alternate'); break; } } } } |