public function BootstrapLayoutsUpdate8402::processExistingLayout in Bootstrap Layouts 8.5
Same name and namespace in other branches
- 8.4 src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php \Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\Updates\BootstrapLayoutsUpdate8402::processExistingLayout()
Provide an update for an existing layout.
Note: this process any existing layout and is not specific to just "Bootstrap Layouts" based layouts. If implementing this update, you should check the $layout->getId() before performing any tasks.
Parameters
\Drupal\bootstrap_layouts\BootstrapLayout $layout: The existing BootstrapLayout instance that is being processed.
array $data: Any static YAML data found for the update.
bool $display_messages: Flag determining whether a message will be displayed indicating whether the layout was processed successfully or not.
Overrides BootstrapLayoutsUpdateBase::processExistingLayout
See also
\Drupal\bootstrap_layouts\BootstrapLayoutsManager::update()
File
- src/
Plugin/ BootstrapLayouts/ Updates/ BootstrapLayoutsUpdate8402.php, line 23
Class
- BootstrapLayoutsUpdate8402
- Bootstrap Layouts Update 8402
Namespace
Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\UpdatesCode
public function processExistingLayout(BootstrapLayout $layout, array $data = [], $display_messages = TRUE) {
if ($layout
->getId() !== 'bs_1col_stacked') {
return;
}
$regions = [
'header' => 'top',
'footer' => 'bottom',
];
foreach ($regions as $old_region => $new_region) {
if ($region = $layout
->getRegion($old_region)) {
$layout
->setRegion($new_region, $region);
$layout
->unsetRegion($old_region);
}
}
}