function UserFormTestHooks::entityBaseFieldInfoAlter
Implements hook_entity_base_field_info_alter().
Attributes
#[Hook('entity_base_field_info_alter')]
File
-
core/
modules/ user/ tests/ modules/ user_form_test/ src/ Hook/ UserFormTestHooks.php, line 27
Class
- UserFormTestHooks
- Hook implementations for user_form_test.
Namespace
Drupal\user_form_test\HookCode
public function entityBaseFieldInfoAlter(&$fields, EntityTypeInterface $entity_type) : void {
if ($entity_type->id() === 'user' && \Drupal::keyvalue('user_form_test')->get('user_form_test_constraint_roles_edit')) {
$fields['roles']->addConstraint('FieldWidgetConstraint');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.