Skip to content
Open

#2737 #415

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 202 additions & 0 deletions modules/access_misc/access_misc.install
Original file line number Diff line number Diff line change
Expand Up @@ -2271,3 +2271,205 @@ function access_misc_update_10036() {
WHERE f.entity_id IS NULL
");
}

/**
* Update node 12067 (Events) body and restore layout builder sections.
*/
function access_misc_update_10037() {
$nid = 12067;

$node = Node::load($nid);
if (!$node) {
return;
}

$sections = [];

// Section 0: One column — body field + Upcoming Tips and Tricks Title block.
$section0 = new \Drupal\layout_builder\Section('layout_onecol', ['label' => '']);
$section0->appendComponent(new \Drupal\layout_builder\SectionComponent(
'c0ffbca3-1681-4cad-9785-aeddb3b5c326',
'content',
[
'id' => 'field_block:node:page:body',
'label_display' => '0',
'context_mapping' => ['entity' => 'layout_builder.entity'],
'formatter' => [
'type' => 'text_default',
'label' => 'hidden',
'settings' => [],
'third_party_settings' => [],
],
]
));
$section0->appendComponent(new \Drupal\layout_builder\SectionComponent(
'd1b12e61-8b1c-4d14-b998-e45938ce78d5',
'content',
[
'id' => 'block_content:9307c992-9a91-494e-81bb-65a64368c624',
'label' => 'Upcoming Tips and Tricks - Title',
'label_display' => '0',
'provider' => 'block_content',
'status' => 1,
'info' => '',
'view_mode' => 'full',
'context_mapping' => [],
]
));
$sections[] = $section0;

// Section 1: Two column (25-75) — Upcoming Tips and Tricks view + filters/facets.
$section1 = new \Drupal\layout_builder\Section('layout_twocol_section', [
'label' => 'Upcoming Tips and Tricks view',
'column_widths' => '25-75',
'context_mapping' => [],
]);
$section1->appendComponent(new \Drupal\layout_builder\SectionComponent(
'b9fe901b-30d4-422e-baaf-6b93ccdc5c33',
'second',
[
'id' => 'views_block:events_facet-upcoming_tips_tricks',
'label' => '',
'label_display' => '0',
'provider' => 'views',
'views_label' => '',
'items_per_page' => 'none',
'exposed' => [],
'context_mapping' => [],
]
));
$section1->appendComponent(new \Drupal\layout_builder\SectionComponent(
'f49f6521-e117-45ba-a2da-6fc406643e43',
'first',
[
'id' => 'views_exposed_filter_block:events_facet-upcoming_tips_tricks',
'label' => '',
'label_display' => '0',
'provider' => 'views',
'views_label' => '',
'context_mapping' => [],
]
));
$section1->appendComponent(new \Drupal\layout_builder\SectionComponent(
'9985f6f3-9ec2-4b05-8b90-bf544efcc4d6',
'first',
[
'id' => 'facet_block:upcoming_tips_tricks_event_affiliation',
'label' => 'Affiliation',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$section1->appendComponent(new \Drupal\layout_builder\SectionComponent(
'6d08a5fb-e24c-49c2-a41e-ab95d74c8cb9',
'first',
[
'id' => 'facet_block:upcoming_tips_tricks_event_affiliation',
'label' => 'Affiliation',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$sections[] = $section1;

// Section 2: One column — Recorded Tips & Tricks Title block.
$section2 = new \Drupal\layout_builder\Section('layout_onecol', ['label' => 'Recorded Tips & Tricks - Title']);
$section2->appendComponent(new \Drupal\layout_builder\SectionComponent(
'bea54677-4101-4ffd-ac13-91068532003d',
'content',
[
'id' => 'block_content:892d3275-03a2-435b-9256-3e681545c077',
'label' => 'Recorded Tips & Tricks - Title',
'label_display' => '0',
'provider' => 'block_content',
'status' => 1,
'info' => '',
'view_mode' => 'full',
'context_mapping' => [],
]
));
$sections[] = $section2;

// Section 3: Two column (25-75) — Recorded Tips and Tricks view + filters/facets.
$section3 = new \Drupal\layout_builder\Section('layout_twocol_section', [
'label' => 'Recorded Tips and Tricks - view',
'column_widths' => '25-75',
'context_mapping' => [],
]);
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'0fe915cd-4677-4cf8-b3a4-4713b361ca96',
'second',
[
'id' => 'views_block:events_facet-recorded_tips_tricks',
'label' => '',
'label_display' => '0',
'provider' => 'views',
'views_label' => '',
'items_per_page' => 'none',
'exposed' => [],
'context_mapping' => [],
]
));
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'87e8504d-68b5-4af3-8e97-bd73f42dce43',
'first',
[
'id' => 'views_exposed_filter_block:events_facet-recorded_tips_tricks',
'label' => '',
'label_display' => '0',
'provider' => 'views',
'views_label' => '',
'context_mapping' => [],
]
));
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'd85fdf88-a2ce-433f-a100-e8466db92f49',
'first',
[
'id' => 'facet_block:recorded_tips_tricks_event_affiliation',
'label' => 'Affiliation',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'65990e19-4ca3-48ad-90e5-596391aa48de',
'first',
[
'id' => 'facet_block:recorded_tips_tricks_tags',
'label' => 'Tags',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'bb414f47-961d-4dab-9a03-22944fc33555',
'first',
[
'id' => 'facet_block:recorded_tips_tricks_event_affiliation',
'label' => 'Affiliation',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$section3->appendComponent(new \Drupal\layout_builder\SectionComponent(
'4df8a82c-0492-46a3-b9ae-3ccacaa4a645',
'first',
[
'id' => 'facet_block:recorded_tips_tricks_tags',
'label' => 'Tags',
'label_display' => 'visible',
'provider' => 'facets',
'context_mapping' => [],
]
));
$sections[] = $section3;

$node->set('layout_builder__layout', $sections);
$node->save();
}
1 change: 1 addition & 0 deletions modules/access_misc/css/collapsiblock.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.path-community,
.page-node-12067,
.path-current-champions,
.path-people,
.path-events,
Expand Down
14 changes: 9 additions & 5 deletions modules/access_misc/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

Drupal.behaviors.accessMiscFiltersHeading = {
attach: function (context, settings) {
// Add "Filters" heading before the first facet block
var $firstBlock = $('.block-facet--checkbox', context).first();
if ($firstBlock.length && !$firstBlock.prev('h2.md--hidden').length) {
$firstBlock.before('<h2 class="md--hidden d-block d-lg-none">Filters</h2>');
}
// Add "Filters" heading before the first facet block in each sibling group.
// Pages with multiple views each have their own container, so checking for
// a preceding facet sibling correctly identifies the first of each group.
$('.block-facet--checkbox', context).each(function () {
var $block = $(this);
if (!$block.prev('.block-facet--checkbox').length && !$block.prev('h2.md--hidden').length) {
$block.before('<h2 class="md--hidden d-block d-lg-none">Filters</h2>');
}
});
}
};

Expand Down