Issue #2937636 by piyuesh23, markconroy: Umami Theme - follow-up - Use hook_form_alter() for search block placeholder
parent
222377929b
commit
42c9e7bbd0
|
@ -1,18 +0,0 @@
|
||||||
{#
|
|
||||||
/**
|
|
||||||
* @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 @@
|
||||||
* 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) {
|
||||||
// "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');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue