Created on 18 April 2023, over 1 year ago
Updated 5 May 2023, over 1 year ago

Is there any way to edit the tooltip text?
Is there any way to hide it altogether?
Interested in both answers.
Thanks.

💬 Support request
Status

Needs review

Version

2.0

Component

User interface

Created by

🇬🇧United Kingdom Katy Jockelson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Katy Jockelson
  • 🇮🇳India shailja179 India

    Hi Katy Jockelson,
    Which tooltip text you are referring to? Are you talking about Select the content types to exclude from the search index.
    ?

    Please elaborate in steps.

  • 🇬🇧United Kingdom Katy Jockelson

    On the front-end. "Enter the terms you wish to search for". See screenshot.

  • Assigned to shailja179
  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shailja179 India
    function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
      if ($form_id == 'search_block_form') {dump($form['keys']['#attributes']['title']);
    
    //To edit
        $form['keys']['#attributes']['placeholder'] = t('Placeholder text');
    
    //To hide
    $form['keys']['#attributes']['placeholder'] = t('');
      }
    }

    There is no setting to edit it. But you can do it in custom module using this code.

  • 🇬🇧United Kingdom Katy Jockelson

    Thank you very much

  • Issue was unassigned.
  • 🇮🇳India Raveen Kumar

    @Katy,
    1) Is there any way to edit the tooltip text?
    Solution:- The search box in Drupal is implemented using the Search module. You can modify the tooltip text by creating a custom module and implementing a hook to alter the search form. Please See attached for edit (changetext.png)

    2) Is there any way to hide it altogether?
    Solution:- Yes, you can hide the tooltip text for the search box in Drupal by modifying the HTML attributes of the search form element by creating a custom module and implementing the hook_form_alter() hook to modify the title attribute of the search form element. By setting the title attribute to an empty string, the tooltip text will not be displayed. (Please see attached for hiding (hidetext.png)

    Let me know if you have still any queries. Please & Thank You.

Production build 0.71.5 2024