Update SearchForm.php

This commit is contained in:
Kyle Huynh 2023-02-10 15:06:44 -05:00 committed by GitHub
parent 134e8aa4aa
commit 0b71b649fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'];