function panelizer_form_entity_view_display_edit_submit in Panelizer 8.5
Same name and namespace in other branches
- 8.3 panelizer.module \panelizer_form_entity_view_display_edit_submit()
- 8.4 panelizer.module \panelizer_form_entity_view_display_edit_submit()
1 string reference to 'panelizer_form_entity_view_display_edit_submit'
File
- ./
panelizer.module, line 324 - Hook implementations for the Panelizer module.
Code
function panelizer_form_entity_view_display_edit_submit(&$form, FormStateInterface $form_state) {
$rebuild = FALSE;
/** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
$form_object = $form_state
->getFormObject();
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
$display = $form_object
->getEntity();
/** @var \Drupal\panelizer\Plugin\PanelizerEntityManager $panelizer_manager */
$panelizer_manager = \Drupal::service('plugin.manager.panelizer_entity');
/** @var \Drupal\panelizer\Panelizer $panelizer */
$panelizer = \Drupal::service('panelizer');
if ($panelizer_manager
->hasDefinition($display
->getTargetEntityTypeId())) {
$settings = $panelizer
->getPanelizerSettings($display
->getTargetEntityTypeId(), $display
->getTargetBundle(), $display
->getMode(), $display);
if ($settings['enable'] != $form_state
->getValue([
'panelizer',
'enable',
])) {
$rebuild = TRUE;
}
$settings['enable'] = $form_state
->getValue([
'panelizer',
'enable',
]);
$settings['custom'] = $form_state
->getValue([
'panelizer',
'custom',
]);
$settings['allow'] = $form_state
->getValue([
'panelizer',
'allow',
]);
$panelizer
->setPanelizerSettings($display
->getTargetEntityTypeId(), $display
->getTargetBundle(), $display
->getMode(), $settings, $display);
if ($rebuild) {
\Drupal::service('router.builder')
->rebuild();
/** @var \Drupal\Core\Menu\LocalActionManager $local_action_manager */
$local_action_manager = \Drupal::service('plugin.manager.menu.local_action');
$local_action_manager
->clearCachedDefinitions();
// Manually reinitialize these.
$local_action_manager
->getDefinitions();
\Drupal::service('cache.render')
->invalidateAll();
}
}
}