hook_entity_field_storage_info_alter

hook_entity_field_storage_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type)

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

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1801
Hooks and documentation related to entities.

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);
  }
}
doc_Drupal
2016-10-29 09:17:59
Comments
Leave a Comment

Please login to continue.