f4fe05af0fe34cfb7f3e905163ea9822161977f3
[civicrm-core.git] / Civi / Api4 / Service / Spec / Provider / TagCreationSpecProvider.php
1 <?php
2
3 namespace Civi\Api4\Service\Spec\Provider;
4
5 use Civi\Api4\Service\Spec\RequestSpec;
6
7 class TagCreationSpecProvider implements Generic\SpecProviderInterface {
8
9 /**
10 * @param \Civi\Api4\Service\Spec\RequestSpec $spec
11 */
12 public function modifySpec(RequestSpec $spec) {
13 $spec->getFieldByName('used_for')->setDefaultValue('civicrm_contact');
14 }
15
16 /**
17 * @param string $entity
18 * @param string $action
19 *
20 * @return bool
21 */
22 public function applies($entity, $action) {
23 return $entity === 'Tag' && $action === 'create';
24 }
25
26 }