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/
24 class Route
extends \Civi\Api4\Generic\AbstractEntity
{
27 * @param bool $checkPermissions
28 * @return Generic\BasicGetAction
30 public static function get($checkPermissions = TRUE) {
31 return (new Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function ($get) {
33 // Pulling from ::items() rather than DB -- because it provides the final/live/altered data.
34 foreach (\CRM_Core_Menu
::items() as $path => $item) {
35 $result[] = ['path' => $path] +
$item;
38 }))->setCheckPermissions($checkPermissions);
42 * @param bool $checkPermissions
43 * @return Generic\BasicGetFieldsAction
45 public static function getFields($checkPermissions = TRUE) {
46 return (new Generic\
BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function() {
50 'title' => 'Relative Path',
51 'data_type' => 'String',
55 'title' => 'Page Title',
56 'data_type' => 'String',
59 'name' => 'page_callback',
60 'title' => 'Page Callback',
61 'data_type' => 'String',
64 'name' => 'page_arguments',
65 'title' => 'Page Arguments',
66 'data_type' => 'String',
69 'name' => 'path_arguments',
70 'title' => 'Path Arguments',
71 'data_type' => 'String',
74 'name' => 'access_arguments',
75 'title' => 'Access Arguments',
76 'data_type' => 'Array',
79 }))->setCheckPermissions($checkPermissions);
85 public static function permissions() {
87 "meta" => ["access CiviCRM"],
88 "default" => ["administer CiviCRM"],