Skip to content
Snippets Groups Projects
Commit 94de17d2 authored by Florent Torregrosa's avatar Florent Torregrosa
Browse files

Issue #3492016 by grimreaper: Views exposed filters and bulk forms: default row cols

parent b4eb7976
No related branches found
No related tags found
1 merge request!235Issue #3492016 by grimreaper: Views exposed filter and bulk form: default row cols
Pipeline #366826 passed
......@@ -42,6 +42,27 @@ class FormAlter {
'afterBuildMarkLayoutBuilder',
];
}
// Default styling for views bulk actions forms. There is no specific form
// ID to target.
if (!\str_starts_with($form['#id'], 'views-form')) {
return;
}
if (isset($form['header'])) {
$headerElements = Element::children($form['header']);
foreach ($headerElements as $headerElement) {
if (!\str_ends_with($headerElement, '_bulk_form')) {
continue;
}
$form['header'][$headerElement]['#attributes']['class'][] = 'row';
$form['header'][$headerElement]['#attributes']['class'][] = 'row-cols-auto';
$form['header'][$headerElement]['#attributes']['class'][] = 'align-items-end';
if (isset($form['header'][$headerElement]['actions'])) {
$form['header'][$headerElement]['actions']['#attributes']['class'][] = 'mb-3';
}
}
}
}
/**
......
......@@ -22,25 +22,25 @@ class FormViewsExposedFormAlter {
* The form ID.
*/
public function alter(array &$form, FormStateInterface $formState, string $form_id): void {
if (!\str_starts_with($form['#id'], 'views-exposed-form-media-library-widget')) {
return;
}
$form['#attributes']['class'][] = 'row';
$form['#attributes']['class'][] = 'row-cols-auto';
$form['#attributes']['class'][] = 'align-items-end';
$form['#attributes']['class'][] = 'm-1';
$form['#attributes']['class'][] = 'mb-3';
$form['#attributes']['class'][] = 'p-2';
$form['#attributes']['class'][] = 'border';
if (isset($form['actions'])) {
$form['actions']['#attributes']['class'][] = 'mb-3';
}
// Reset button.
if (isset($form['actions']['reset'])) {
$form['actions']['reset']['#attributes']['class'][] = 'ms-2';
}
if (!\str_starts_with($form['#id'], 'views-exposed-form-media-library-widget')) {
return;
}
$form['#attributes']['class'][] = 'm-1';
$form['#attributes']['class'][] = 'mb-3';
$form['#attributes']['class'][] = 'p-2';
$form['#attributes']['class'][] = 'border';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment