From f3823fb8f5a6e801ec53e9fe253b27f05e62384f Mon Sep 17 00:00:00 2001
From: hatuhay <alberto@siles.pe>
Date: Wed, 20 Jun 2018 18:10:50 -0500
Subject: [PATCH] Adjust initial settings

---
 bootstrap_barrio.theme                                   | 9 +++++++++
 config/install/bootstrap_barrio.settings.yml             | 1 +
 .../install/bootstrap_barrio_subtheme.settings.yml       | 1 +
 theme-settings.php                                       | 6 ++++++
 4 files changed, 17 insertions(+)

diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme
index 2e35a0b..5ca940b 100644
--- a/bootstrap_barrio.theme
+++ b/bootstrap_barrio.theme
@@ -406,6 +406,15 @@ function bootstrap_barrio_theme_suggestions_form_alter(array &$suggestions, arra
   }
 }
 
+/**
+ * Implements hook_theme_suggestions_HOOK_alter() for form templates.
+ */
+function bootstrap_barrio_theme_suggestions_input_alter(array &$suggestions, array $variables) {
+  if ($variables['element']['#type'] == 'submit' && theme_get_setting('bootstrap_barrio_button')) {
+    $suggestions[] = 'input__submit_button';
+  }
+}
+
 /**
  * Implements hook_form_alter() to add classes to the search form.
 
diff --git a/config/install/bootstrap_barrio.settings.yml b/config/install/bootstrap_barrio.settings.yml
index 6cbe04b..06c0528 100644
--- a/config/install/bootstrap_barrio.settings.yml
+++ b/config/install/bootstrap_barrio.settings.yml
@@ -16,6 +16,7 @@ bootstrap_barrio_fluid_container: 0
 
 # Buttons
 # --------------
+bootstrap_barrio_button: 1
 bootstrap_barrio_button_size: ''
 bootstrap_barrio_button_outline: 0
 
diff --git a/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml b/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml
index d4cf32c..0d32c60 100644
--- a/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml
+++ b/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml
@@ -16,6 +16,7 @@ bootstrap_barrio_fluid_container: 0
 
 # Buttons
 # --------------
+bootstrap_barrio_button: 1
 bootstrap_barrio_button_size: ''
 bootstrap_barrio_button_outline: 0
 
diff --git a/theme-settings.php b/theme-settings.php
index 9c8d5a6..8a0222f 100644
--- a/theme-settings.php
+++ b/theme-settings.php
@@ -179,6 +179,12 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
+  $form['components']['buttons']['bootstrap_barrio_button'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Convert input submit to button element'),
+    '#default_value' => theme_get_setting('bootstrap_barrio_button'),
+    '#description' => t('Convert all input submit to button element. There is a known issue with Ajax Exposed Filters, which do not work as the ajax commands expects an input element, no other issues have been detected at the time.'),
+  );
   $form['components']['buttons']['bootstrap_barrio_button_size'] = array(
     '#type' => 'select',
     '#title' => t('Default button size'),
-- 
GitLab