Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldHooks.php

function FieldHooks::fieldConfigInsert

Implements hook_ENTITY_TYPE_insert() for 'field_config'.

File

core/modules/field/src/Hook/FieldHooks.php, line 294

Class

FieldHooks
Hook implementations for field.

Namespace

Drupal\field\Hook

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal