So far I have tried this code in mytheme.theme:
function mytheme_form_search_block_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) { $form['keys']['#attributes']['placeholder'] = t('Custom wording'); }
And this one:
function mytheme_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) { if ($form_id == 'search_block_form') { $form['keys']['#attributes']['placeholder'] = t('Custom wording'); } }
Also this one:
function mytheme_form_search_block_form_alter(&$form, $form_state) { $form['keys']['#attributes']['placeholder'] = t('Custom wording'); }
Site is not crashing, but nothing happens on the placeholder.
I have based these 3 snippets on these pages:
Sponsored by SupremePR