3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 |
9 +--------------------------------------------------------------------+
16 * Provides page routes registered in the CiviCRM menu system.
18 * Note: this is a read-only api as routes are set via xml files and hooks.
20 * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/
25 class Route
extends \Civi\Api4\Generic\AbstractEntity
{
28 * @param bool $checkPermissions
29 * @return Generic\BasicGetAction
31 public static function get($checkPermissions = TRUE) {
32 return (new Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
34 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
35 foreach (\CRM_Core_Menu
::items() as $path => $item) {
36 $result[] = ['path' => $path] +
$item;
39 }))->setCheckPermissions($checkPermissions);
43 * @param bool $checkPermissions
44 * @return Generic\BasicGetFieldsAction
46 public static function getFields($checkPermissions = TRUE) {
47 return (new Generic\
BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function() {
51 'title' => 'Relative Path',
52 'data_type' => 'String',
56 'title' => 'Page Title',
57 'data_type' => 'String',
60 'name' => 'page_callback',
61 'title' => 'Page Callback',
62 'data_type' => 'String',
65 'name' => 'page_arguments',
66 'title' => 'Page Arguments',
67 'data_type' => 'String',
70 'name' => 'path_arguments',
71 'title' => 'Path Arguments',
72 'data_type' => 'String',
75 'name' => 'access_arguments',
76 'title' => 'Access Arguments',
77 'data_type' => 'Array',
80 }))->setCheckPermissions($checkPermissions);
86 public static function permissions() {
88 "meta" => ["access CiviCRM"],
89 "default" => ["administer CiviCRM"],