-
-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27182 from civicrm/5.65
5.65
- Loading branch information
Showing
5 changed files
with
542 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Civi\Api4\Service\Spec\Provider; | ||
|
||
use Civi\Api4\Service\Spec\RequestSpec; | ||
|
||
/** | ||
* This applies to all entities with an email field. | ||
* | ||
* In the contact of "get", email validation doesn't make sense so change it to text. | ||
* | ||
* @service | ||
* @internal | ||
*/ | ||
class EmailGetSpecProvider extends \Civi\Core\Service\AutoService implements Generic\SpecProviderInterface { | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function modifySpec(RequestSpec $spec) { | ||
foreach ($spec->getFields() as $field) { | ||
if ($field->getInputType() === 'Email') { | ||
$field->setInputType('Text'); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function applies($entity, $action) { | ||
return $action === 'get'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.