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
23 use Civi\Api4\Generic\BasicGetFieldsAction
;
28 * Provides page routes registered in the CiviCRM menu system.
30 * Note: this is a read-only api as routes are set via xml files and hooks.
32 * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/
36 class Route
extends \Civi\Api4\Generic\AbstractEntity
{
39 * @return \Civi\Api4\Generic\BasicGetAction
41 public static function get() {
42 return new \Civi\Api4\Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
43 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
44 $items = \CRM_Core_Menu
::items();
46 foreach ($items as $path => $item) {
47 $result[] = ['path' => $path] +
$item;
53 public static function getFields() {
54 return new BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function() {
58 'title' => 'Relative Path',
60 'data_type' => 'String',
64 'title' => 'Page Title',
66 'data_type' => 'String',
69 'name' => 'page_callback',
70 'title' => 'Page Callback',
72 'data_type' => 'String',
75 'name' => 'page_arguments',
76 'title' => 'Page Arguments',
78 'data_type' => 'String',
81 'name' => 'path_arguments',
82 'title' => 'Path Arguments',
84 'data_type' => 'String',
87 'name' => 'access_arguments',
88 'title' => 'Access Arguments',
90 'data_type' => 'Array',
99 public static function permissions() {
101 "meta" => ["access CiviCRM"],
102 "default" => ["administer CiviCRM"],