Skip to content
Snippets Groups Projects
Commit 42c9e7bb authored by catch's avatar catch
Browse files

Issue #2937636 by piyuesh23, markconroy: Umami Theme - follow-up - Use...

Issue #2937636 by piyuesh23, markconroy: Umami Theme - follow-up - Use hook_form_alter() for search block placeholder
parent 22237792
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
{#
/**
* @file
* Theme override for an 'input' #type form element.
*
* Available variables:
* - attributes: A list of HTML attributes for the input element.
* - children: Optional additional rendered elements.
*
* @see template_preprocess_input()
*/
#}
{%
set placeholder_text = 'Search by keyword, ingredient, dish'
%}
<input{{ attributes.setAttribute('placeholder', placeholder_text) }} />{{ children }}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Functions to support theming in the Umami theme. * Functions to support theming in the Umami theme.
*/ */
use Drupal\Core\Form\FormStateInterface;
use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface;
/** /**
...@@ -81,3 +82,10 @@ function umami_preprocess_breadcrumb(&$variables) { ...@@ -81,3 +82,10 @@ function umami_preprocess_breadcrumb(&$variables) {
// "Home > Articles" on the Recipes page, which should read "Home > Recipes". // "Home > Articles" on the Recipes page, which should read "Home > Recipes".
$variables['#cache']['contexts'][] = 'url'; $variables['#cache']['contexts'][] = 'url';
} }
/**
* Implements hook_form_FORM_ID_alter().
*/
function umami_form_search_block_form_alter(&$form, FormStateInterface $form_state) {
$form['keys']['#attributes']['placeholder'] = t('Search by keyword, ingredient, dish');
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment