blob: 94c68d9d093a998988487619b125721d69976086 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
namespace Civi\Api4\Service\Spec\Provider;
use Civi\Api4\Service\Spec\RequestSpec;
class ContactCreationSpecProvider implements SpecProviderInterface {
/**
* @param RequestSpec $spec
*/
public function modifySpec(RequestSpec $spec) {
$spec->getFieldByName('contact_type')
->setRequired(TRUE)
->setDefaultValue('Individual');
$spec->getFieldByName('is_opt_out')->setRequired(FALSE);
$spec->getFieldByName('is_deleted')->setRequired(FALSE);
}
/**
* @param string $entity
* @param string $action
*
* @return bool
*/
public function applies($entity, $action) {
return $entity === 'Contact' && $action === 'create';
}
}
|