If you make a view and add the Node operations bulk form, two "Apply to selected items" boxes are automatically generated like this:

two apply to selected items boxes

How do I get rid of one of these?

I turned on twig debugging, but the template that is outputting the button is core/modules/system/templates/container.html.twig, which is not something that I can easily customize to remove one of the buttons.

How I created the view:

  1. Create a new view of content showing fields.
  2. Add Node operations bulk form under Fields.
  3. Save the view.

This is intentional functionality for some workflows (for long lists of results).

If you wanted to get rid of the button, you could hook_form_alter it away. Form IDs and array structure are dynamic based on your view so you'll have to adjust accordingly based on the view & action button to remove (this can be found in the Views UI, if not known).

 * Implements hook_form_alter().
function MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // @TODO: Determine view_id / display_id / field_id for a specific VBO form:
  if ($form_id == 'views_form_' . $view_id . '_' . $display_id) {
| improve this answer | |
  • For the node operatiosn bulk form, the $field_id is node_bulk_form. – Patrick Kenny Jul 2 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.