From 0b71b649fc0e41208e99b9dcdc55cb54129da4c3 Mon Sep 17 00:00:00 2001 From: Kyle Huynh <7862086+kylehuynh205@users.noreply.github.com> Date: Fri, 10 Feb 2023 15:06:44 -0500 Subject: [PATCH] Update SearchForm.php --- src/Form/SearchForm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Form/SearchForm.php b/src/Form/SearchForm.php index 6bed783..6c7acba 100644 --- a/src/Form/SearchForm.php +++ b/src/Form/SearchForm.php @@ -34,7 +34,7 @@ class SearchForm extends FormBase ]; } else { - $block = \Drupal\block\Entity\Block::load("search"); + $block = \Drupal\block\Entity\Block::load($this->block_id); if ($block) { $settings = $block->get('settings'); @@ -45,8 +45,8 @@ class SearchForm extends FormBase '#type' => 'textfield', '#title' => (!empty($settings['search_textfield_label']) ? $settings['search_textfield_label'] : ''), '#attributes' => [ - 'placeholder' => $this->t($settings['search_placeholder']), - 'aria-label' => $this->t($settings['search_placeholder']), + 'placeholder' => isset($settings['search_placeholder']) ? $this->t($settings['search_placeholder']) : $this->t("Search collections"), + 'aria-label' => (isset($settings['search_textfield_label']) ? $this->t($settings['search_textfield_label']) : $this->t('Enter Keyword')) ], '#theme_wrappers' => [] ); @@ -67,7 +67,7 @@ class SearchForm extends FormBase */ public function submitForm(array &$form, FormStateInterface $form_state) { - $block = \Drupal\block\Entity\Block::load("search"); + $block = \Drupal\block\Entity\Block::load($this->block_id); if ($block) { $settings = $block->get('settings'); $view_machine_name = $settings['search_view_machine_name'];