Skip to content

Commit

Permalink
Merge pull request #186 from localgovdrupal/2.x
Browse files Browse the repository at this point in the history
2.1.14 release
  • Loading branch information
ekes authored Jan 20, 2025
2 parents ecad662 + 385e09f commit 3312370
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ status: true
dependencies:
enforced:
module:
- localgov_guides
- localgov_menu_link_group
- localgov_guides
- localgov_menu_link_group
id: localgov_menu_link_group_guide
group_label: Guide
weight: 0
Expand Down
2 changes: 1 addition & 1 deletion localgov_guides.module
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function localgov_guides_preprocess_node__localgov_guides_overview__full(&$vars)

if ($guide_overview_node->hasField('localgov_guides_section_title') && !$guide_overview_node->localgov_guides_section_title->isEmpty()) {
$guide_overview_title = $guide_overview_node->localgov_guides_section_title->value;
};
}

$vars['guide_overview_title'] = $guide_overview_title ?: $guide_overview_default_title;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/PageHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(protected EntityRepositoryInterface $entityRepositor
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
public static function getSubscribedEvents(): array {
return [
PageHeaderDisplayEvent::EVENT_NAME => ['setPageHeader', 0],
];
Expand Down
16 changes: 10 additions & 6 deletions src/Plugin/PreviewLinkAutopopulate/Guides.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Guides extends PreviewLinkAutopopulatePluginBase {
* {@inheritdoc}
*/
public function getPreviewEntities(): array {
$overview = NULL;
$guide_nodes = [];

// Find guide overview.
Expand All @@ -36,13 +37,16 @@ public function getPreviewEntities(): array {
elseif ($node->bundle() == 'localgov_guides_page') {
$overview = $node->get('localgov_guides_parent')->entity;
}
$guide_nodes[] = $overview;

// Find guide pages.
$guide_pages = $overview->get('localgov_guides_pages')->referencedEntities();
foreach ($guide_pages as $guide_page) {
if ($guide_page instanceof NodeInterface && $guide_page->access('view')) {
$guide_nodes[] = $guide_page;
if ($overview instanceof NodeInterface) {
$guide_nodes[] = $overview;

// Find guide pages.
$guide_pages = $overview->get('localgov_guides_pages')->referencedEntities();
foreach ($guide_pages as $guide_page) {
if ($guide_page instanceof NodeInterface && $guide_page->access('view')) {
$guide_nodes[] = $guide_page;
}
}
}

Expand Down

0 comments on commit 3312370

Please sign in to comment.