From: Coleman Watts Date: Wed, 11 Aug 2021 00:04:06 +0000 (-0400) Subject: CRM_Core_Component - Remove unused code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=89c997b9f67102a6061ebe80eb333b9b1e867ec7;p=civicrm-core.git CRM_Core_Component - Remove unused code --- diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index c594c3b6d8..6a3123bd90 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -203,24 +203,6 @@ class CRM_Core_Component { return $files; } - /** - * @return array - */ - public static function &menu() { - $info = self::_info(); - $items = []; - foreach ($info as $name => $comp) { - $mnu = $comp->getMenuObject(); - - $ret = $mnu->permissioned(); - $items = array_merge($items, $ret); - - $ret = $mnu->main($task); - $items = array_merge($items, $ret); - } - return $items; - } - /** * @param string $componentName * @@ -231,9 +213,6 @@ class CRM_Core_Component { if (!empty($info[$componentName])) { return $info[$componentName]->componentID; } - else { - return; - } } /** diff --git a/CRM/Core/Component/Info.php b/CRM/Core/Component/Info.php index 33dabe3639..604fcd7a65 100644 --- a/CRM/Core/Component/Info.php +++ b/CRM/Core/Component/Info.php @@ -221,20 +221,7 @@ abstract class CRM_Core_Component_Info { */ public function isEnabled() { $config = CRM_Core_Config::singleton(); - if (in_array($this->info['name'], $config->enableComponents)) { - return TRUE; - } - return FALSE; - } - - /** - * Provides component's menu definition object. - * - * @return mixed - * component's menu definition object - */ - public function getMenuObject() { - return $this->_instantiate(self::COMPONENT_MENU_CLASS); + return in_array($this->info['name'], $config->enableComponents, TRUE); } /** @@ -352,7 +339,6 @@ abstract class CRM_Core_Component_Info { */ private function _instantiate($cl) { $className = $this->namespace . '_' . $cl; - require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; return new $className(); }