You are here

function config_pages_import_update_panelizer in Config Pages 7

Handle panelizer on config import from other context.

Parameters

ConfigPages $original_config: Original config.

ConfigPages $config: New config for saving.

Return value

ConfigPages Normalized new config.

1 call to config_pages_import_update_panelizer()
config_pages_import_form_submit in ./config_pages.admin.inc
config_pages_import_form submit handler.

File

./config_pages.admin.inc, line 218
ConfigPages editing UI.

Code

function config_pages_import_update_panelizer($original_config, $config) {

  // If panelizer exists, delete any panelizer data.
  if (!empty($original_config->panelizer)) {

    /** @var PanelizerEntityConfigPages $handler */
    $handler = panelizer_entity_plugin_get_handler('config_pages');
    $handler
      ->delete_entity_panelizer($original_config);
  }

  // Mark as modified and remove copied entity_id, panelizer will clone the
  // displays for the destination entity.
  if (!empty($config->panelizer)) {
    foreach ($config->panelizer as $view_mode => $panelizer) {
      $panelizer->display_is_modified = TRUE;
      $panelizer->entity_id = NULL;
    }
  }
  return $config;
}