1a9188dc8d43d8ad4b78da989fd4a8ef54d895d8
[civicrm-core.git] / Civi / Api4 / Service / Spec / Provider / NavigationSpecProvider.php
1 <?php
2
3 namespace Civi\Api4\Service\Spec\Provider;
4
5 use Civi\Api4\Service\Spec\RequestSpec;
6
7 class NavigationSpecProvider implements Generic\SpecProviderInterface {
8
9 /**
10 * This runs for both create and get actions
11 *
12 * @inheritDoc
13 */
14 public function modifySpec(RequestSpec $spec) {
15 $spec->getFieldByName('domain_id')->setRequired(FALSE)->setDefaultValue('current_domain');
16 }
17
18 /**
19 * @inheritDoc
20 */
21 public function applies($entity, $action) {
22 return $entity === 'Navigation' && in_array($action, ['create', 'get']);
23 }
24
25 }