diff --git a/oit_dev.install b/oit_dev.install index 86deb42..ff30f96 100644 --- a/oit_dev.install +++ b/oit_dev.install @@ -40,7 +40,7 @@ function oit_dev_install() { $this_user->save(); } // Pull in archived news to add to add to robots.txt. - new AddToRobots(); + \Drupal::service('oit_dev.robots'); } /** diff --git a/src/Plugin/AddToRobots.php b/src/Plugin/AddToRobots.php index 5315750..b6fdc6e 100644 --- a/src/Plugin/AddToRobots.php +++ b/src/Plugin/AddToRobots.php @@ -24,6 +24,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { $node = $this->entityTypeManager->getStorage('node'); $query = $node->getQuery(); $query->condition('field_news_archive', 3); + $query->accessCheck(FALSE); $news_results = $query->execute(); $news_archive_string = "# Paths OIT\n"; $news_archive_string .= "Disallow: /taxonomy/term/*\n";