function LayoutBuilderHooks::fieldConfigInsert

Implements hook_field_config_insert().

File

core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php, line 115

Class

LayoutBuilderHooks
Hook implementations for layout_builder.

Namespace

Drupal\layout_builder\Hook

Code

public function fieldConfigInsert(FieldConfigInterface $field_config) {
    // Clear the sample entity for this entity type and bundle.
    $sample_entity_generator = \Drupal::service('layout_builder.sample_entity_generator');
    $sample_entity_generator->delete($field_config->getTargetEntityTypeId(), $field_config->getTargetBundle());
    \Drupal::service('plugin.manager.block')->clearCachedDefinitions();
}

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