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

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

OEL-543: Facets form alter.

parent 65ac7107
No related branches found
No related tags found
1 merge request!27OEL-543: Styling components.
......@@ -7,6 +7,8 @@
declare(strict_types = 1);
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook__preprocess_links__language_block().
*/
......@@ -64,3 +66,28 @@ function oe_whitelabel_preprocess_links__language_block(&$variables) {
],
];
}
/**
* Implements hook_form_FORM_ID_alter() for facets_forms.
*/
function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (isset($form['actions'])) {
$form['actions']['#attributes']['class'][] = 'mt-4';
}
if (isset($form['actions']['submit'])) {
$submit_classes = ['me-2', 'btn', 'btn-primary'];
foreach ($submit_classes as $submit_class) {
if (!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'];
foreach ($reset_classes as $reset_class) {
if (!in_array($reset_class, $form['actions']['reset']['#attributes']['class'], TRUE)) {
$form['actions']['reset']['#attributes']['class'][] = $reset_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