[NFC] Remove some more of the old cvs blocks
[civicrm-core.git] / Civi / Api4 / Service / Spec / Provider / ContactTypeCreationSpecProvider.php
CommitLineData
19b53e5b
C
1<?php
2
380f3545
TO
3/*
4 +--------------------------------------------------------------------+
41498ac5 5 | Copyright CiviCRM LLC. All rights reserved. |
380f3545 6 | |
41498ac5
TO
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
380f3545
TO
10 +--------------------------------------------------------------------+
11 */
12
19b53e5b
C
13namespace Civi\Api4\Service\Spec\Provider;
14
15use Civi\Api4\Service\Spec\RequestSpec;
16
016d95d3 17/**
18 * Class ContactTypeCreationSpecProvider
19 *
20 * @package Civi\Api4\Service\Spec\Provider
21 */
19b53e5b
C
22class ContactTypeCreationSpecProvider implements Generic\SpecProviderInterface {
23
24 /**
25 * @param \Civi\Api4\Service\Spec\RequestSpec $spec
26 */
27 public function modifySpec(RequestSpec $spec) {
28 $spec->getFieldByName('label')->setRequired(TRUE);
29 $spec->getFieldByName('name')->setRequired(TRUE);
30 $spec->getFieldByName('parent_id')->setRequired(TRUE);
31
32 }
33
34 /**
35 * @param string $entity
36 * @param string $action
37 *
38 * @return bool
39 */
40 public function applies($entity, $action) {
41 return $entity === 'ContactType' && $action === 'create';
42 }
43
44}