Created
December 8, 2016 23:20
-
-
Save anthonysimone/b3e0ed9048826211046952e92150b2d2 to your computer and use it in GitHub Desktop.
Add a default `null` selection to the bulk actions dropdown on the main content page so `delete` is not the default action.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Implements hook_form_FORM_ID_alter(). | |
| * | |
| * Specifically get the view content page form, look for the bulk field in the header, and add a non-item as default | |
| */ | |
| function HOOK_form_views_form_content_page_1_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { | |
| if (isset($form['header']['node_bulk_form']['action']['#type']) && $form['header']['node_bulk_form']['action']['#type'] === 'select') { | |
| $form['header']['node_bulk_form']['action']['#options'] = array('' => '- Select Action -') + $form['header']['node_bulk_form']['action']['#options']; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment