class TextTestHooks
Hook implementations for text_test.
Hierarchy
- class \Drupal\text_test\Hook\TextTestHooks
Expanded class hierarchy of TextTestHooks
File
-
core/
modules/ text/ tests/ modules/ text_test/ src/ Hook/ TextTestHooks.php, line 14
Namespace
Drupal\text_test\HookView source
class TextTestHooks {
public function __construct(protected readonly StateInterface $state) {
}
/**
* Implements hook_entity_bundle_field_info_alter().
*/
public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity_type, $bundle) : void {
if (($field_name = $this->state
->get('field_test_constraint', FALSE)) && $entity_type->id() == 'node') {
/** @var \Drupal\field\Entity\FieldConfig[] $fields */
$fields[$field_name]->addConstraint('UniqueField');
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
TextTestHooks::entityBundleFieldInfoAlter | public | function | Implements hook_entity_bundle_field_info_alter(). |
TextTestHooks::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.