1

I'm trying to alter the text on the bulk operations submit button. It seems the standard hook_form_alter() does not work in this context.

The standard text is Apply to selected items and I want to change that for a particular view.

Code:

function mytheme_form_alter(&$form, $form_state, $form_id) {
  if ($form['#id'] == 'views-exposed-form-print-selected-pages-page-1') {
    // I can't find the button in $form.
  }
}

When I look at the generated source I can see that the bulk operations form has a form ID like views-exposed-form-print-selected-pages-page-1-asd1235x that changes between page reloads.

closed as too broad by mradcliffe, Pierre.Vriens, Neograph734, kiamlaluno Feb 10 '17 at 19:11

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I remember doing this in Drupal 7 with hook_form_alter() so +1 if there's an alternative. It might be better to include your hook_form_alter() implementation in case there is an issue there. – mradcliffe Feb 10 '17 at 14:40
  • I agree with @mradcliffe. Please provide the code you have used rather than saying it does not work. – Neograph734 Feb 10 '17 at 16:42
  • form alter should work, but you should also be able to use Interface translation for that. Note that in Drupal 8, you can just enable the locale module and then you can enable translations also for english, with a certain overhead of course (but no more than any non-english site has anyway) – Berdir Feb 10 '17 at 20:43
  • If I use the Interface translation would that not change the text of all the Bulk operation submit buttons? – Peter Feb 13 '17 at 7:11

Browse other questions tagged or ask your own question.