diff --git a/composer.json b/composer.json index b4111d5..b1f36ac 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "drupal/pathauto": "^1.6", "drupal/search_api": "^1.29", "drupal/search_api_autocomplete": "^1.3", - "drupal/search_api_location": "1.x-dev", + "drupal/search_api_location": "1.x-dev#cf3e546770099b1f136c020ade79a650d4178ad6", "localgovdrupal/localgov_core": "^2.12", "localgovdrupal/localgov_geo": "^2.0" }, diff --git a/src/Plugin/PreviewLinkAutopopulate/DirectoryChannel.php b/src/Plugin/PreviewLinkAutopopulate/DirectoryChannel.php new file mode 100644 index 0000000..c305ad4 --- /dev/null +++ b/src/Plugin/PreviewLinkAutopopulate/DirectoryChannel.php @@ -0,0 +1,45 @@ +getEntity(); + + // Find all directory pages. + $pages = $this->entityTypeManager->getStorage('node') + ->loadByProperties([ + 'localgov_directory_channels' => $channel->id(), + ]); + foreach ($pages as $page) { + if ($page instanceof NodeInterface && $page->access('view')) { + $nodes[] = $page; + } + } + + return $nodes; + } + +}