diff --git a/core/lib/Drupal/Core/Render/Element/BulkOperations.php b/core/lib/Drupal/Core/Render/Element/BulkOperations.php new file mode 100644 index 0000000..fefaf13 --- /dev/null +++ b/core/lib/Drupal/Core/Render/Element/BulkOperations.php @@ -0,0 +1,11 @@ + 'details', - '#title' => $this->t('Update options'), - '#open' => TRUE, - '#attributes' => array('class' => array('container-inline')), + '#type' => 'bulk_operations', ); if ($type == 'approval') { @@ -117,7 +114,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = ' $form['options']['operation'] = array( '#type' => 'select', '#title' => $this->t('Action'), - '#title_display' => 'invisible', '#options' => $options, '#default_value' => 'publish', ); diff --git a/core/modules/system/src/Plugin/views/field/BulkForm.php b/core/modules/system/src/Plugin/views/field/BulkForm.php index f9f581b..7793288 100644 --- a/core/modules/system/src/Plugin/views/field/BulkForm.php +++ b/core/modules/system/src/Plugin/views/field/BulkForm.php @@ -275,7 +275,7 @@ public function viewsForm(&$form, FormStateInterface $form_state) { // Ensure a consistent container for filters/operations in the view header. $form['header'] = array( - '#type' => 'container', + '#type' => 'bulk_operations', '#weight' => -100, ); diff --git a/core/themes/seven/css/components/form.css b/core/themes/seven/css/components/form.css index f3acc2c..e6fb227 100644 --- a/core/themes/seven/css/components/form.css +++ b/core/themes/seven/css/components/form.css @@ -222,6 +222,40 @@ textarea.form-textarea { } /** + * Adds border and background to the bulk action form. + */ +.form-wrapper--bulk-form { + background-color: #f5f5f2; + border-top: 1px solid #e6e4df; + border-bottom: 1px solid #e6e4df; + margin: 1em 0; + padding: 6px 12px; +} +.form-wrapper--bulk-form .form-item, +.form-wrapper--bulk-form .form-actions, +.form-wrapper--bulk-form input, +.form-wrapper--bulk-form label, +.form-wrapper--bulk-form select { + display: inline-block; + margin: 0; +} +.form-wrapper--bulk-form input, +.form-wrapper--bulk-form label, +.form-wrapper--bulk-form select { + margin-right: 10px; +} +.form-wrapper--bulk-form .form-actions { + margin-top: 0.75em; + margin-bottom: 0.75em; +} +[dir="rtl"] .form-wrapper--bulk-form input, +[dir="rtl"] .form-wrapper--bulk-form label, +[dir="rtl"] .form-wrapper--bulk-form select { + margin-left: 10px; + margin-right: 0; +} + +/** * Limits extra long instances of select elements to the max width allowed * to avoid breaking layouts. */ diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 5ace6b8..2179c39 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -126,6 +126,10 @@ function seven_element_info_alter(&$type) { if (isset($type['button'])) { $type['button']['#attached']['library'][] = 'core/modernizr'; } + + if (isset($type['bulk_operations'])) { + $type['bulk_operations']['#pre_render'][] = 'seven_bulk_operations_pre_render'; + } } /** @@ -186,3 +190,12 @@ function seven_form_node_form_alter(&$form, FormStateInterface $form_state) { $form['revision_information']['#type'] = 'container'; $form['revision_information']['#group'] = 'meta'; } + +/** + * #pre_render callback: Sets a variation class for bulk form form wrapper. + */ +function seven_bulk_operations_pre_render($element) { + $element['#attributes']['class'][] = 'form-wrapper--bulk-form'; + + return $element; +}