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/
33 class Route
extends \Civi\Api4\Generic\AbstractEntity
{
36 * @param bool $checkPermissions
37 * @return Generic\BasicGetAction
39 public static function get($checkPermissions = TRUE) {
40 return (new Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
42 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
43 foreach (\CRM_Core_Menu
::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',
60 'data_type' => 'String',
64 'title' => 'Page Title',
65 'data_type' => 'String',
68 'name' => 'page_callback',
69 'title' => 'Page Callback',
70 'data_type' => 'String',
73 'name' => 'page_arguments',
74 'title' => 'Page Arguments',
75 'data_type' => 'String',
78 'name' => 'path_arguments',
79 'title' => 'Path Arguments',
80 'data_type' => 'String',
83 'name' => 'access_arguments',
84 'title' => 'Access Arguments',
85 'data_type' => 'Array',
88 }))->setCheckPermissions($checkPermissions);
94 public static function permissions() {
96 "meta" => ["access CiviCRM"],
97 "default" => ["administer CiviCRM"],