diff --git a/core/modules/help_topics/config/optional/block.block.seven_help_search.yml b/core/modules/help_topics/config/optional/block.block.seven_help_search.yml index 6c3cfdea76..d44236ce9d 100644 --- a/core/modules/help_topics/config/optional/block.block.seven_help_search.yml +++ b/core/modules/help_topics/config/optional/block.block.seven_help_search.yml @@ -1,6 +1,9 @@ langcode: en status: true dependencies: + enforced: + config: + - search.page.help_search module: - search - system diff --git a/core/modules/search/src/Form/SearchBlockForm.php b/core/modules/search/src/Form/SearchBlockForm.php index f3a7a8ce36..4edcd73a10 100644 --- a/core/modules/search/src/Form/SearchBlockForm.php +++ b/core/modules/search/src/Form/SearchBlockForm.php @@ -77,7 +77,6 @@ public function getFormId() { */ public function buildForm(array $form, FormStateInterface $form_state, $entity_id = NULL) { // Set up the form to submit using GET to the correct search page. - // But first, make sure this search page is active. if (!$entity_id) { $entity_id = $this->searchPageRepository->getDefaultSearchPage(); // SearchPageRepository::getDefaultSearchPage() depends on @@ -88,12 +87,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_i $this->renderer->addCacheableDependency($form, $this->configFactory->get('search.settings')); } - if ($entity_id) { - $pages = $this->searchPageRepository->getActiveSearchPages(); - $entity = $pages[$entity_id] ?? NULL; - } - - if (!isset($entity)) { + if (!$entity_id) { $form['message'] = [ '#markup' => $this->t('Search is currently disabled'), ]; diff --git a/core/modules/search/src/SearchPageRepositoryInterface.php b/core/modules/search/src/SearchPageRepositoryInterface.php index 7ed5d43a82..6169fbcfe9 100644 --- a/core/modules/search/src/SearchPageRepositoryInterface.php +++ b/core/modules/search/src/SearchPageRepositoryInterface.php @@ -34,8 +34,8 @@ public function getIndexableSearchPages(); /** * Returns the default search page. * - * @return string|false - * The default search page entity ID, or FALSE if no pages are active. + * @return \Drupal\search\SearchPageInterface|bool + * The search page entity, or FALSE if no pages are active. */ public function getDefaultSearchPage();