8e996ecb1a75dab49c86d0ed4b589123dd3ac92d
[civicrm-core.git] / Civi / Api4 / Service / Spec / Provider / OptionValueCreationSpecProvider.php
1 <?php
2
3 namespace Civi\Api4\Service\Spec\Provider;
4
5 use Civi\Api4\Service\Spec\RequestSpec;
6
7 class OptionValueCreationSpecProvider implements Generic\SpecProviderInterface {
8
9 /**
10 * @inheritDoc
11 */
12 public function modifySpec(RequestSpec $spec) {
13 $spec->getFieldByName('weight')->setRequired(FALSE);
14 $spec->getFieldByName('value')->setRequired(FALSE);
15 }
16
17 /**
18 * @inheritDoc
19 */
20 public function applies($entity, $action) {
21 return $entity === 'OptionValue' && $action === 'create';
22 }
23
24 }