diff --git a/src/Form/ServiceSearchForm.php b/src/Form/ServiceSearchForm.php index 6371ff865fe0325e38304339e9c976521b45d68e..e232b6726d7c5b34d79e0923c80c5e657328a2a6 100644 --- a/src/Form/ServiceSearchForm.php +++ b/src/Form/ServiceSearchForm.php @@ -34,26 +34,28 @@ class ServiceSearchForm extends FormBase { * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. - * @param string|null $description - * The description for the input element. + * @param bool $use_placeholder + * Flag to user placeholder. * @param string|null $placeholder * The placeholder string. + * @param string|null $description + * The description for the input element. * * @return array * The form structure. */ - public function buildForm(array $form, FormStateInterface $form_state, string $description = NULL, string $placeholder = NULL): array { + public function buildForm(array $form, FormStateInterface $form_state, bool $use_placeholder = TRUE, string $placeholder = NULL, string $description = NULL): array { // If there is no placeholder sent, then set it to // search all services. - if (!$placeholder) { + if ($use_placeholder && $placeholder == NULL) { $placeholder = 'Search within all services'; } // The search input. $form['search_input'] = [ '#type' => 'textfield', - '#placeholder' => $placeholder, + '#placeholder' => $use_placeholder ? $placeholder : NULL, '#description' => $description ?? NULL, '#required' => TRUE, ];