function lightning_landing_page_field_config_insert in Lightning Layout 8
Implements hook_ENTITY_TYPE_insert().
File
- modules/
lightning_landing_page/ lightning_landing_page.module, line 17 - Contains landing page functionality for Lightning.
Code
function lightning_landing_page_field_config_insert(FieldConfigInterface $field) {
// Don't do anything during config sync.
if (\Drupal::isConfigSyncing()) {
return;
}
elseif ($field
->id() == 'node.landing_page.field_meta_tags') {
$component = [
'type' => 'metatag_empty_formatter',
'region' => 'content',
];
lightning_layout_entity_get_display('node', 'landing_page')
->setComponent('field_meta_tags', $component)
->save();
lightning_layout_entity_get_display('node', 'landing_page', 'full')
->setComponent('field_meta_tags', $component)
->save();
lightning_layout_entity_get_display('node', 'landing_page', 'teaser')
->setComponent('field_meta_tags', $component)
->save();
lightning_layout_entity_get_form_display('node', 'landing_page')
->setComponent('field_meta_tags', [
'type' => 'metatag_firehose',
'region' => 'content',
])
->save();
}
}