Merge pull request #22848 from braders/extension-manager-notices
[civicrm-core.git] / CRM / Admin / Page / Admin.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17
18/**
ce064e4f 19 * Page for displaying Administer CiviCRM Control Panel.
6a488035
TO
20 */
21class CRM_Admin_Page_Admin extends CRM_Core_Page {
62d3ee27 22
e0ef6999 23 /**
ce064e4f 24 * Run page.
25 *
e0ef6999
EM
26 * @return string
27 */
00be9182 28 public function run() {
4ef8abc2
CW
29 Civi::resources()->addStyleFile('civicrm', 'css/admin.css');
30
be2fb01f 31 $groups = [
353ffa53 32 'Customize Data and Screens' => ts('Customize Data and Screens'),
6a488035
TO
33 'Communications' => ts('Communications'),
34 'Localization' => ts('Localization'),
35 'Users and Permissions' => ts('Users and Permissions'),
36 'System Settings' => ts('System Settings'),
be2fb01f 37 ];
6a488035
TO
38
39 $config = CRM_Core_Config::singleton();
6a488035 40
2067db51
AH
41 foreach ($config->enableComponents as $component) {
42 $comp = CRM_Core_Component::get($component);
43 $groups[$comp->info['name']] = $comp->info['translatedName'];
6a488035
TO
44 }
45
46 $values = CRM_Core_Menu::getAdminLinks();
47
6a488035
TO
48 foreach ($groups as $group => $title) {
49 $groupId = str_replace(' ', '_', $group);
2067db51 50 $adminPanel[$groupId] = array_merge($values[$group] ?? [], ['title' => $title]);
6a488035 51 }
8f4eb478 52
53 CRM_Utils_Hook::alterAdminPanel($adminPanel);
2067db51
AH
54 foreach ($adminPanel as $groupId => $group) {
55 if (count($group) == 1) {
56 // Presumably the only thing is the title; remove the section.
57 // This is done here to give the hook a chance to edit the section.
58 unset($adminPanel[$groupId]);
59 }
60 }
6a488035 61 $this->assign('adminPanel', $adminPanel);
6a488035
TO
62 return parent::run();
63 }
96025800 64
6a488035 65}