4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
24 * Provides page routes registered in the CiviCRM menu system.
26 * Note: this is a read-only api as routes are set via xml files and hooks.
28 * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/
32 class Route
extends \Civi\Api4\Generic\AbstractEntity
{
35 * @param bool $checkPermissions
36 * @return \Civi\Api4\Generic\BasicGetAction
38 public static function get($checkPermissions = TRUE) {
39 return (new \Civi\Api4\Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
40 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
41 $items = \CRM_Core_Menu
::items();
43 foreach ($items as $path => $item) {
44 $result[] = ['path' => $path] +
$item;
47 }))->setCheckPermissions($checkPermissions);
51 * @param bool $checkPermissions
52 * @return Generic\BasicGetFieldsAction
54 public static function getFields($checkPermissions = TRUE) {
55 return (new Generic\
BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function() {
59 'title' => 'Relative Path',
61 'data_type' => 'String',
65 'title' => 'Page Title',
67 'data_type' => 'String',
70 'name' => 'page_callback',
71 'title' => 'Page Callback',
73 'data_type' => 'String',
76 'name' => 'page_arguments',
77 'title' => 'Page Arguments',
79 'data_type' => 'String',
82 'name' => 'path_arguments',
83 'title' => 'Path Arguments',
85 'data_type' => 'String',
88 'name' => 'access_arguments',
89 'title' => 'Access Arguments',
91 'data_type' => 'Array',
94 }))->setCheckPermissions($checkPermissions);
100 public static function permissions() {
102 "meta" => ["access CiviCRM"],
103 "default" => ["administer CiviCRM"],