function hook_entity_bundle_field_info_alter
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_field_info_alter()
- 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_field_info_alter()
- 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_field_info_alter()
Alter bundle field definitions.
@todo WARNING: This hook will be changed in https://www.drupal.org/node/2346347.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface[] $fields: The array of bundle field definitions.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
string $bundle: The bundle.
See also
hook_entity_base_field_info_alter()
hook_entity_bundle_field_info()
Related topics
2 functions implement hook_entity_bundle_field_info_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- field_test_entity_bundle_field_info_alter in core/
modules/ field/ tests/ modules/ field_test/ field_test.module - Implements hook_entity_bundle_field_info_alter().
- forum_entity_bundle_field_info_alter in core/
modules/ forum/ forum.module - Implements hook_entity_bundle_field_info_alter().
File
-
core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 2035
Code
function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
if ($entity_type->id() == 'node' && $bundle == 'article' && !empty($fields['my_module_text'])) {
// Alter the my_module_text field to use a custom class.
$fields['my_module_text']->setClass('\\Drupal\\another_module\\EntityComputedText');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.