function EntityTestConstraintsHooks::entityTypeBuild

Same name and namespace in other branches
  1. main core/modules/system/tests/modules/entity_test_constraints/src/Hook/EntityTestConstraintsHooks.php \Drupal\entity_test_constraints\Hook\EntityTestConstraintsHooks::entityTypeBuild()

Implements hook_entity_type_build().

Attributes

#[Hook('entity_type_build')]

File

core/modules/system/tests/modules/entity_test_constraints/src/Hook/EntityTestConstraintsHooks.php, line 17

Class

EntityTestConstraintsHooks
Hook implementations for entity_test_constraints.

Namespace

Drupal\entity_test_constraints\Hook

Code

public function entityTypeBuild(array &$entity_types) : void {
  if ($extra = \Drupal::state()->get('entity_test_constraints.build')) {
    foreach ($extra as $id => $option) {
      $entity_types['entity_test_constraints']->addConstraint($id, $option);
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.