You are here

panels_everywhere.install in Panels Everywhere 8.4

Same filename and directory in other branches
  1. 6 panels_everywhere.install
  2. 7 panels_everywhere.install

Install, update, etc hooks for Panels Everywhere.

File

panels_everywhere.install
View source
<?php

/**
 * @file
 * Install, update, etc hooks for Panels Everywhere.
 */

/**
 * Implementations of hook_update_N().
 */

/**
 * Rename layout machine names in config entities to match layout discovery's
 * default layouts.
 */
function panels_everywhere_update_8400() {
  $names = \Drupal::configFactory()
    ->listAll('page_manager.page_variant');
  foreach ($names as $name) {
    $config = \Drupal::configFactory()
      ->getEditable($name);
    if ($config
      ->get('variant') === 'panels_everywhere_variant') {
      module_load_install('panels');
      if (!function_exists('panels_convert_plugin_ids_to_layout_discovery')) {
        throw new \Exception('Panels helper function does not exist, the latest Panels 4.x-dev snapshot is required to run this update.');
      }
      $layout_id = $config
        ->get('variant_settings.layout');
      if ($new_layout_id = panels_convert_plugin_ids_to_layout_discovery($layout_id)) {
        $config
          ->set('variant_settings.layout', $new_layout_id);
        $config
          ->save();
      }
    }
  }
}

Functions

Namesort descending Description
panels_everywhere_update_8400 Rename layout machine names in config entities to match layout discovery's default layouts.