X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FApi4%2FRoute.php;h=6681b645ecfb6294485ddfc40fb948f20a71cb2c;hb=6b1506ee3970ed5ee7621dfb2dd504947637254f;hp=f3d36bc61cbce6315a0bd6ee53861a09a9f14538;hpb=9c204b425c4f161f3dec52e3d7f0cae2f9f35eb5;p=civicrm-core.git diff --git a/Civi/Api4/Route.php b/Civi/Api4/Route.php index f3d36bc61c..6681b645ec 100644 --- a/Civi/Api4/Route.php +++ b/Civi/Api4/Route.php @@ -14,14 +14,10 @@ * * @package CRM * @copyright CiviCRM LLC https://civicrm.org/licensing - * $Id$ - * */ namespace Civi\Api4; -use Civi\Api4\Generic\BasicGetFieldsAction; - /** * CiviCRM menu route. * @@ -30,16 +26,17 @@ use Civi\Api4\Generic\BasicGetFieldsAction; * Note: this is a read-only api as routes are set via xml files and hooks. * * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/ - * + * @searchable false * @package Civi\Api4 */ class Route extends \Civi\Api4\Generic\AbstractEntity { /** + * @param bool $checkPermissions * @return \Civi\Api4\Generic\BasicGetAction */ - public static function get() { - return new \Civi\Api4\Generic\BasicGetAction(__CLASS__, __FUNCTION__, function ($get) { + public static function get($checkPermissions = TRUE) { + return (new \Civi\Api4\Generic\BasicGetAction(__CLASS__, __FUNCTION__, function ($get) { // Pulling from ::items() rather than DB -- because it provides the final/live/altered data. $items = \CRM_Core_Menu::items(); $result = []; @@ -47,11 +44,15 @@ class Route extends \Civi\Api4\Generic\AbstractEntity { $result[] = ['path' => $path] + $item; } return $result; - }); + }))->setCheckPermissions($checkPermissions); } - public static function getFields() { - return new BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { + /** + * @param bool $checkPermissions + * @return Generic\BasicGetFieldsAction + */ + public static function getFields($checkPermissions = TRUE) { + return (new Generic\BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { return [ [ 'name' => 'path', @@ -90,7 +91,7 @@ class Route extends \Civi\Api4\Generic\AbstractEntity { 'data_type' => 'Array', ], ]; - }); + }))->setCheckPermissions($checkPermissions); } /**