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

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

OEL-543: Styling bootstrap forms.

parent e34072c1
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,25 @@ 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');
if (($key = array_search('btn-secondary', $form['actions']['submit']['#attributes']['class'], TRUE)) !== FALSE) {
unset($form['actions']['submit']['#attributes']['class'][$key]);
}
}
$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