function field_field_config_insert

Same name in other branches
  1. 9 core/modules/field/field.module \field_field_config_insert()
  2. 8.9.x core/modules/field/field.module \field_field_config_insert()
  3. 11.x core/modules/field/field.module \field_field_config_insert()

Implements hook_ENTITY_TYPE_insert() for 'field_config'.

File

core/modules/field/field.module, line 343

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.