Skip to content
Snippets Groups Projects

fix: [DS-1191] Add a banner section to the default LB display

1 file
+ 34
0
Compare changes
  • Side-by-side
  • Inline
@@ -237,6 +237,19 @@ function _y_program_subcategory_create_sections_layout_builder() {
]);
$section->appendComponent($component);
// Section Banner
$section = new Section('bootstrap_layout_builder:blb_col_1', [
'container' => 'container-fluid',
'label' => 'Banner',
'container_wrapper' => [
'bootstrap_styles' => [
'background' => ['background_type' => 'color'],
'background_color' => ['class' => 'ylb-bg-white'],
],
],
]);
$sections[] = $section;
// Section Body
$sections[] = new Section('bootstrap_layout_builder:blb_col_1', [
'container' => 'container',
@@ -366,3 +379,24 @@ function _y_program_subcategory_update_displays_on_unistall() {
$view_display->save();
}
}
/**
* Update default layout of LB view.
*/
function y_program_subcategory_update_9001(&$sandbox = NULL) {
$entity_display_repository = \Drupal::service('entity_display.repository');
// Update Branch content type view displays.
$view_modes = $entity_display_repository
->getViewModeOptionsByBundle('node', 'program_subcategory');
foreach ($view_modes as $view_mode => $view_mode_value) {
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
$view_display = $entity_display_repository->getViewDisplay('node', 'program_subcategory', $view_mode);
if ($view_mode == 'full') {
$sections = _y_program_subcategory_create_sections_layout_builder();
$view_display
->setThirdPartySetting('layout_builder', 'sections', $sections);
$view_display->save();
}
}
}
Loading