Source of file CMSBatchAction_HideFromMenus.php
Size: 0,807 Bytes - Last Modified: 2022-02-21T10:00:28+00:00
/var/www/docs.ssmods.com/process/src/code/CMSBatchAction_HideFromMenus.php
12345678910111213141516171819202122232425262728293031323334353637383940 | <?php /** * Extra Batch Action: Hide from Menus * Sets the show in menus property on sitetree to false * * @package BatchActionsPlus */ class CMSBatchAction_HideFromMenus extends CMSBatchAction { public function getActionTitle() { return _t('CMSBatchActions.HIDEFROMMENUS', 'Hide from menus'); } public function run(SS_List $pages) { $status = array( 'modified'=>array() ); foreach($pages as $page) { $id = $page->ID; // Perform the action $page->ShowInMenus = 0; $page->write(); $status['modified'][$id] = array( 'TreeTitle' => $page->TreeTitle ); } return $this->response(_t('CMSBatchActions.HIDDENMENUS', 'Hidden from menus'), $status); } public function applicablePages($ids) { return $this->applicablePagesHelper($ids, 'canEdit', false, true); } } |