panels.install in Panels 8.4
Same filename and directory in other branches
Contains update functions for Page Manager.
File
panels.installView source
<?php
/**
* @file
* Contains update functions for Page Manager.
*/
/**
* Implements hook_requirements().
*
* @todo: Remove this when https://www.drupal.org/node/2641658 is fixed.
*/
function panels_requirements($phase) {
$requirements = [];
// Check that core actually is >= 8.3.0
if (!version_compare(\Drupal::VERSION, '8.3', '>=')) {
$requirements['panels_core_version'] = [
'title' => t('Panels Drupal core version'),
'value' => \Drupal::VERSION,
'description' => t('Panels requires at least Drupal core 8.3.'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}
/**
* Helper function for updating panels created layouts to layout discovery
*/
function panels_convert_plugin_ids_to_layout_discovery($layout_id) {
// For layouts we know about, return what the new ID should be.
// If we don't recognize the layout ID, return false to not update the config.
switch ($layout_id) {
case 'onecol':
return 'layout_onecol';
case 'threecol_25_50_25':
return 'layout_threecol_25_50_25';
case 'threecol_25_50_25_stacked':
return 'layout_threecol_25_50_25';
case 'threecol_33_34_33':
return 'layout_threecol_33_34_33';
case 'threecol_33_34_33_stacked':
return 'layout_threecol_33_34_33';
case 'twocol':
return 'layout_twocol';
case 'twocol_bricks':
return 'layout_twocol_bricks';
case 'twocol_stacked':
return 'layout_twocol';
default:
return FALSE;
}
}
/**
* Uninstalls Layout plugin, then enables Layout Discovery.
*/
function panels_update_8401() {
if (\Drupal::moduleHandler()
->moduleExists('layout_plugin')) {
\Drupal::service('module_installer')
->uninstall([
'layout_plugin',
], FALSE);
\Drupal::service('module_installer')
->install([
'layout_discovery',
], FALSE);
}
}
Functions
Name![]() |
Description |
---|---|
panels_convert_plugin_ids_to_layout_discovery | Helper function for updating panels created layouts to layout discovery |
panels_requirements | Implements hook_requirements(). |
panels_update_8401 | Uninstalls Layout plugin, then enables Layout Discovery. |