class EntityTestConstraintsHooks
Hook implementations for entity_test_constraints.
Hierarchy
- class \Drupal\entity_test_constraints\Hook\EntityTestConstraintsHooks
Expanded class hierarchy of EntityTestConstraintsHooks
File
-
core/
modules/ system/ tests/ modules/ entity_test_constraints/ src/ Hook/ EntityTestConstraintsHooks.php, line 12
Namespace
Drupal\entity_test_constraints\HookView source
class EntityTestConstraintsHooks {
/**
* Implements hook_entity_type_build().
*/
public function entityTypeBuild(array &$entity_types) {
if ($extra = \Drupal::state()->get('entity_test_constraints.build')) {
foreach ($extra as $id => $option) {
$entity_types['entity_test_constraints']->addConstraint($id, $option);
}
}
}
/**
* Implements hook_entity_type_alter().
*/
public function entityTypeAlter(array &$entity_types) : void {
if ($alter = \Drupal::state()->get('entity_test_constraints.alter')) {
$entity_types['entity_test_constraints']->setConstraints($alter);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.