function hook_entity_field_storage_info_alter
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_field_storage_info_alter()
- 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_field_storage_info_alter()
- 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_field_storage_info_alter()
Alter field storage definitions for a content entity type.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface[] $fields: The array of field storage definitions for the entity type.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
See also
hook_entity_field_storage_info()
Related topics
File
-
core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 2073
Code
function hook_entity_field_storage_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) {
// Alter the max_length setting.
if ($entity_type->id() == 'node' && !empty($fields['mymodule_text'])) {
$fields['mymodule_text']->setSetting('max_length', 128);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.