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 Generic\BasicGetAction
38 public static function get($checkPermissions = TRUE) {
39 return (new Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
41 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
42 foreach (\CRM_Core_Menu
::items() as $path => $item) {
43 $result[] = ['path' => $path] +
$item;
46 }))->setCheckPermissions($checkPermissions);
50 * @param bool $checkPermissions
51 * @return Generic\BasicGetFieldsAction
53 public static function getFields($checkPermissions = TRUE) {
54 return (new Generic\
BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function() {
58 'title' => 'Relative Path',
59 'data_type' => 'String',
63 'title' => 'Page Title',
64 'data_type' => 'String',
67 'name' => 'page_callback',
68 'title' => 'Page Callback',
69 'data_type' => 'String',
72 'name' => 'page_arguments',
73 'title' => 'Page Arguments',
74 'data_type' => 'String',
77 'name' => 'path_arguments',
78 'title' => 'Path Arguments',
79 'data_type' => 'String',
82 'name' => 'access_arguments',
83 'title' => 'Access Arguments',
84 'data_type' => 'Array',
87 }))->setCheckPermissions($checkPermissions);
93 public static function permissions() {
95 "meta" => ["access CiviCRM"],
96 "default" => ["administer CiviCRM"],