From 9eec5a3571631a38c70c925536be740aa373b9d4 Mon Sep 17 00:00:00 2001
From: wodby <wodby@example.com>
Date: Tue, 23 Nov 2021 19:30:44 +0000
Subject: [PATCH] ISTWCMS-5127: updating services search

---
 src/Form/ServiceSearchForm.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/Form/ServiceSearchForm.php b/src/Form/ServiceSearchForm.php
index 6371ff8..e232b67 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,
     ];
-- 
GitLab