 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) {   