From 96504b8c83e392468543a53006314ff81dc7f7ee Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Tue, 5 Oct 2021 18:05:33 +0200
Subject: [PATCH 1/9] OEL-543: Styling bootstrap forms.

---
 oe_whitelabel.theme | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
index 87447e81..6d248288 100644
--- a/oe_whitelabel.theme
+++ b/oe_whitelabel.theme
@@ -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']);
+}
-- 
GitLab


From 30d268e8a32decab101c2d7585c5b9ec78897656 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Wed, 6 Oct 2021 15:54:34 +0200
Subject: [PATCH 2/9] OEL-543: Form alter changes.

---
 oe_whitelabel.theme | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
index 6d248288..29dbc956 100644
--- a/oe_whitelabel.theme
+++ b/oe_whitelabel.theme
@@ -77,14 +77,11 @@ function oe_whitelabel_form_alter(&$form, FormStateInterface $form_state, $form_
   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']);
   }
-  $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']);
   }
-  $form['actions']['reset']['#attributes']['class'] = array_unique($form['actions']['reset']['#attributes']['class']);
 }
-- 
GitLab


From 7d8e76fb420bd6120865ef288d408aa6eb221747 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Wed, 6 Oct 2021 17:30:19 +0200
Subject: [PATCH 3/9] OEL-543: Remove template for views-exposed-form.

---
 .../search/form--views-exposed-form.html.twig | 24 -------------------
 1 file changed, 24 deletions(-)
 delete mode 100755 templates/overrides/search/form--views-exposed-form.html.twig

diff --git a/templates/overrides/search/form--views-exposed-form.html.twig b/templates/overrides/search/form--views-exposed-form.html.twig
deleted file mode 100755
index 49345483..00000000
--- a/templates/overrides/search/form--views-exposed-form.html.twig
+++ /dev/null
@@ -1,24 +0,0 @@
-{#
-/**
- * @file
- * Template for a 'form' element.
- *
- * Available variables
- * - attributes: A list of HTML attributes for the wrapper element.
- * - children: The child elements of the form.
- *
- * @see template_preprocess_form()
- *
- * @ingroup themeable
- */
-#}
-{%
-  set classes = [
-    'float-lg-end',
-    'd-md-block',
-  ]
-%}
-
-<form{{ attributes.addClass(classes) }}>
-  {{ children }}
-</form>
-- 
GitLab


From e24c4fa89763610c62043e462af3bbb2ea87fb73 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Mon, 11 Oct 2021 17:13:20 +0200
Subject: [PATCH 4/9] OEL-543: Floated exposed filter plugin.

---
 composer.json                                 |  1 +
 .../sort/FloatEndSortWidget.php               | 29 +++++++++++++++++++
 oe_whitelabel.theme                           | 21 --------------
 3 files changed, 30 insertions(+), 21 deletions(-)
 create mode 100644 modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php

diff --git a/composer.json b/composer.json
index 3580e82b..9b9e0683 100644
--- a/composer.json
+++ b/composer.json
@@ -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",
diff --git a/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php
new file mode 100644
index 00000000..1990736e
--- /dev/null
+++ b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php
@@ -0,0 +1,29 @@
+<?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';
+  }
+
+}
diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
index 29dbc956..87447e81 100644
--- a/oe_whitelabel.theme
+++ b/oe_whitelabel.theme
@@ -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']);
-  }
-}
-- 
GitLab


From 24d3e8a68b6c64c7baa3f083ea65d5793f1846af Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Fri, 15 Oct 2021 16:26:48 +0200
Subject: [PATCH 5/9] OEL-543: Move BEF to require-dev.

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 9b9e0683..b1b64591 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,6 @@
     "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",
@@ -18,6 +17,7 @@
         "composer/installers": "^1.11",
         "drupal/core-composer-scaffold": "^8.9 || ^9.1",
         "drupal/config_devel": "~1.2",
+        "drupal/better_exposed_filters": "^5.0@beta",
         "drupal/drupal-extension": "~4.1",
         "drush/drush": "^10.3",
         "openeuropa/code-review": "1.6",
-- 
GitLab


From 65ac7107a49dcaf1d2a474caf2f99963dc3e1865 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Fri, 15 Oct 2021 16:27:52 +0200
Subject: [PATCH 6/9] OEL-543: Minor name and label changes on custom sort
 plugin.

---
 .../Plugin/better_exposed_filters/sort/FloatEndSortWidget.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php
index 1990736e..cdda606a 100644
--- a/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php
+++ b/modules/oe_whitelabel_helper/src/Plugin/better_exposed_filters/sort/FloatEndSortWidget.php
@@ -11,8 +11,8 @@ 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"),
+ *   id = "oe_whitelabel_float_end_sort",
+ *   label = @Translation("Float End Sort"),
  * )
  */
 class FloatEndSortWidget extends DefaultWidget {
-- 
GitLab


From df7483ed154229d39a07ef4cc799a59d9fe6d929 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Fri, 15 Oct 2021 16:35:14 +0200
Subject: [PATCH 7/9] OEL-543: Facets form alter.

---
 oe_whitelabel.theme | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
index 87447e81..428887ca 100644
--- a/oe_whitelabel.theme
+++ b/oe_whitelabel.theme
@@ -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;
+      }
+    }
+  }
+}
-- 
GitLab


From 10f3b72a20b00cb16696befc1c946b081850af18 Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Mon, 18 Oct 2021 10:41:23 +0200
Subject: [PATCH 8/9] OEL-543: Ensure attributes exists before insert classes.

---
 oe_whitelabel.theme | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
index 428887ca..11537821 100644
--- a/oe_whitelabel.theme
+++ b/oe_whitelabel.theme
@@ -77,7 +77,7 @@ function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_s
   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)) {
+      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;
       }
     }
@@ -85,7 +85,7 @@ function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_s
   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)) {
+      if (!isset($form['actions']['reset']['#attributes']['class']) || !in_array($reset_class, $form['actions']['reset']['#attributes']['class'], TRUE)) {
         $form['actions']['reset']['#attributes']['class'][] = $reset_class;
       }
     }
-- 
GitLab


From 0ecc9d01ebeccb13401f5441c3c00b51374566de Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Mon, 18 Oct 2021 18:26:16 +0200
Subject: [PATCH 9/9] OEL-543: Modify oe_bootstrap_theme release.

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index b1b64591..f9947d6d 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
         "drupal/core": "^8.9 || ^9.1",
         "drupal/ui_patterns": "^1.0",
         "drupal/ui_patterns_settings": "^1.0",
-        "openeuropa/oe_bootstrap_theme": "0.011020211805"
+        "openeuropa/oe_bootstrap_theme": "0.181020211745"
     },
     "require-dev": {
         "composer/installers": "^1.11",
-- 
GitLab