684ffb3da55f77930159e679841d3e5a8423d270
[yaffs-website] / web / core / modules / system / tests / modules / entity_test_constraints / entity_test_constraints.module
1 <?php
2
3 /**
4  * @file
5  * Test module file.
6  */
7
8 /**
9  * Implements hook_entity_type_build().
10  */
11 function entity_test_constraints_entity_type_build(array &$entity_types) {
12   if ($extra = \Drupal::state()->get('entity_test_constraints.build')) {
13     foreach ($extra as $id => $option) {
14       $entity_types['entity_test_constraints']->addConstraint($id, $option);
15     }
16   }
17 }
18
19 /**
20  * Implements hook_entity_type_alter().
21  */
22 function entity_test_constraints_entity_type_alter(array &$entity_types) {
23   if ($alter = \Drupal::state()->get('entity_test_constraints.alter')) {
24     $entity_types['entity_test_constraints']->setConstraints($alter);
25   }
26 }