Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit e24c4fa8 authored by escuriola's avatar escuriola
Browse files

OEL-543: Floated exposed filter plugin.

parent 7d8e76fb
No related branches found
No related tags found
1 merge request!27OEL-543: Styling components.
......@@ -7,6 +7,7 @@
"prefer-stable": true,
"require": {
"php": ">=7.3",
"drupal/better_exposed_filters": "^5.0@beta",
"drupal/components": "^2.4",
"drupal/core": "^8.9 || ^9.1",
"drupal/ui_patterns": "^1.0",
......
<?php
declare(strict_types = 1);
namespace Drupal\oe_whitelabel_helper\Plugin\better_exposed_filters\sort;
use Drupal\better_exposed_filters\Plugin\better_exposed_filters\sort\DefaultWidget;
use Drupal\Core\Form\FormStateInterface;
/**
* OpenEuropa custom better exposed filters widget implementation.
*
* @BetterExposedFiltersSortWidget(
* id = "float_end_sort",
* label = @Translation("Float End Sort Better Exposed Filter"),
* )
*/
class FloatEndSortWidget extends DefaultWidget {
/**
* {@inheritdoc}
*/
public function exposedFormAlter(array &$form, FormStateInterface $form_state) {
parent::exposedFormAlter($form, $form_state);
$form['#attributes']['class'][] = 'float-lg-end';
$form['#attributes']['class'][] = 'd-md-block';
}
}
......@@ -7,8 +7,6 @@
declare(strict_types = 1);
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook__preprocess_links__language_block().
*/
......@@ -66,22 +64,3 @@ function oe_whitelabel_preprocess_links__language_block(&$variables) {
],
];
}
/**
* Implements hook_form_alter().
*/
function oe_whitelabel_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (isset($form['actions'])) {
$form['actions']['#attributes']['class'][] = 'mt-4';
}
if (isset($form['actions']['submit'])) {
$form['actions']['submit']['#attributes']['class'][] = 'me-2';
array_push($form['actions']['submit']['#attributes']['class'], 'btn', 'btn-primary');
$form['actions']['submit']['#attributes']['class'] = array_unique($form['actions']['submit']['#attributes']['class']);
}
if (isset($form['actions']['reset'])) {
$form['actions']['reset']['#attributes']['class'][] = 'btn';
$form['actions']['reset']['#attributes']['class'][] = 'btn-secondary';
$form['actions']['reset']['#attributes']['class'] = array_unique($form['actions']['reset']['#attributes']['class']);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment