function field_field_config_insert in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field/field.module \field_field_config_insert()
- 10 core/modules/field/field.module \field_field_config_insert()
Implements hook_ENTITY_TYPE_insert() for 'field_config'.
File
- core/
modules/ field/ field.module, line 342 - Attach custom data fields to Drupal entities.
Code
function field_field_config_insert(FieldConfigInterface $field) {
if ($field
->isSyncing()) {
// Don't change anything during a configuration sync.
return;
}
// Allow other view modes to update their configuration for the new field.
// Otherwise, configuration for view modes won't get updated until the mode
// is used for the first time, creating noise in config diffs.
\Drupal::classResolver(EntityDisplayRebuilder::class)
->rebuildEntityTypeDisplays($field
->getTargetEntityTypeId(), $field
->getTargetBundle());
}