Drupal Answers Asked on December 4, 2021
If you make a view and add the Node operations bulk form, two "Apply to selected items" boxes are automatically generated like this:
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:
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) {
// HEADER ACTION BUTTON:
//unset($form['header'][$field_id]['actions']);
// FOOTER ACTION BUTTON:
//unset($form['actions']['submit']);
}
Answered by Shawn Conn on December 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP