From 2fa2aa356ffd1b6099263d48662dd0ac14b41665 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 15 Oct 2024 12:51:55 +1300 Subject: [PATCH] ENH Use config instead of runtime code to remove menu items --- _config.php | 10 ---------- code/Controllers/CMSPageAddController.php | 2 ++ code/Controllers/CMSPageEditController.php | 2 ++ code/Controllers/CMSPageSettingsController.php | 2 ++ 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/_config.php b/_config.php index 0fb43491..6c1deee0 100644 --- a/_config.php +++ b/_config.php @@ -1,10 +1,5 @@ register( 'sitetree_link', [SiteTree::class, 'link_shortcode_handler'] ); - -CMSMenu::remove_menu_class(CMSMain::class); -CMSMenu::remove_menu_class(CMSPageEditController::class); -CMSMenu::remove_menu_class(CMSPageSettingsController::class); -CMSMenu::remove_menu_class(CMSPageAddController::class); diff --git a/code/Controllers/CMSPageAddController.php b/code/Controllers/CMSPageAddController.php index 37f1e221..59a3a5c1 100644 --- a/code/Controllers/CMSPageAddController.php +++ b/code/Controllers/CMSPageAddController.php @@ -32,6 +32,8 @@ class CMSPageAddController extends CMSPageEditController private static $menu_title = 'Add page'; private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; + private static $ignore_menuitem = true; + private static $allowed_actions = [ 'AddForm', 'doAdd', diff --git a/code/Controllers/CMSPageEditController.php b/code/Controllers/CMSPageEditController.php index 271d5929..2bd91981 100644 --- a/code/Controllers/CMSPageEditController.php +++ b/code/Controllers/CMSPageEditController.php @@ -28,6 +28,8 @@ class CMSPageEditController extends CMSMain private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; + private static $ignore_menuitem = true; + private static $allowed_actions = [ 'AddToCampaignForm', ]; diff --git a/code/Controllers/CMSPageSettingsController.php b/code/Controllers/CMSPageSettingsController.php index 34353c7c..bf401573 100644 --- a/code/Controllers/CMSPageSettingsController.php +++ b/code/Controllers/CMSPageSettingsController.php @@ -15,6 +15,8 @@ class CMSPageSettingsController extends CMSMain private static $required_permission_codes = 'CMS_ACCESS_CMSMain'; + private static $ignore_menuitem = true; + public function getEditForm($id = null, $fields = null) { $record = $this->getRecord($id ?: $this->currentPageID());