Skip to content

Commit

Permalink
OEL-719: Adapt offcanvas and buttons to BCL 0.11.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
escuriola committed Nov 2, 2021
1 parent 20dcdf6 commit 08744d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 8 additions & 3 deletions oe_whitelabel.theme
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@ function oe_whitelabel_preprocess_links__language_block(&$variables) {
*/
function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (isset($form['actions'])) {
$form['actions']['#attributes']['class'][] = 'mt-4';
$action_classes = ['mt-4', 'd-grid', 'gap-4', 'd-md-block'];
foreach ($action_classes as $action_class) {
if (!isset($action_class, $form['actions']['#attributes']['class']) || !in_array($action_class, $form['actions']['#attributes']['class'], TRUE)) {
$form['actions']['#attributes']['class'][] = $action_class;
}
}
}
if (isset($form['actions']['submit'])) {
$submit_classes = ['me-2', 'btn', 'btn-primary'];
$submit_classes = ['me-md-3', 'btn', 'btn-primary', 'btn-md'];
foreach ($submit_classes as $submit_class) {
if (!isset($submit_class, $form['actions']['submit']['#attributes']['class']) || !in_array($submit_class, $form['actions']['submit']['#attributes']['class'], TRUE)) {
$form['actions']['submit']['#attributes']['class'][] = $submit_class;
}
}
}
if (isset($form['actions']['reset'])) {
$reset_classes = ['btn', 'btn-secondary'];
$reset_classes = ['btn', 'btn-light', 'btn-md'];
foreach ($reset_classes as $reset_class) {
if (!isset($form['actions']['reset']['#attributes']['class']) || !in_array($reset_class, $form['actions']['reset']['#attributes']['class'], TRUE)) {
$form['actions']['reset']['#attributes']['class'][] = $reset_class;
Expand Down
9 changes: 6 additions & 3 deletions templates/overrides/search/block--facets-form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'url': content.actions['reset']['#url'].toString(),
'style': 'secondary',
'attributes': extra_attributes.addClass('ms-2')
})
})
%}
{% set actions = content.actions %}
{% set actions = actions|merge({('reset'): reset}) %}
Expand All @@ -49,7 +49,7 @@
'label': label,
'heading': 4,
'extra_classes': "mb-lg-4",
},
},
'attributes': attributes.addClass('bcl-offcanvas'),
'offcanvas_id': 'bcl-offcanvas',
'body': content,
Expand All @@ -61,6 +61,9 @@
'extra_classes_header': "p-lg-0",
'with_trigger': true,
'toggle_button_label': label,
'icon_name': 'sliders'
'icon_position': 'before',
'icon': {
'name': 'filter',
},
}) }}
{% endblock %}
3 changes: 2 additions & 1 deletion templates/overrides/search/facets-result-item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* @ingroup themeable
*/
#}
{% set attributes = create_attribute({'class': ['me-2']}) %}
{% set attributes = create_attribute({'class': ['me-2', 'fs-6']}) %}
{{ pattern('badge', {
'background': 'light',
'label': value,
'assistive_text': assistive_text,
'dismissible': true,
Expand Down

0 comments on commit 08744d6

Please sign in to comment.