Loading bootstrap_barrio.theme +5 −4 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ function bootstrap_barrio_preprocess_input(&$variables) { ]; $button_sizes = ['btn-sm', 'btn-lg']; $button_is_outline = theme_get_setting('bootstrap_barrio_button_outline'); $button_type = theme_get_setting('bootstrap_barrio_button_type'); if (is_object($variables['attributes']['class'])) { \Drupal::logger('bootstrap_barrio')->notice(implode($variables['attributes']['class']->value())); if (!in_array('btn', $variables['attributes']['class']->value())) { Loading @@ -713,10 +714,10 @@ function bootstrap_barrio_preprocess_input(&$variables) { } if (empty(array_intersect($button_types, $variables['attributes']['class']->value()))) { if ($button_is_outline) { $variables['attributes']['class']->addClass('btn-outline-primary'); $variables['attributes']['class']->addClass('btn-outline-' . $button_type); } else { $variables['attributes']['class']->addClass('btn-primary'); $variables['attributes']['class']->addClass('btn-' . $button_type); } } if ($button_size && empty(array_intersect($button_sizes, $variables['attributes']['class']->value()))) { Loading @@ -729,10 +730,10 @@ function bootstrap_barrio_preprocess_input(&$variables) { } if (empty(array_intersect($button_types, $variables['attributes']['class']))) { if ($button_is_outline) { $variables['attributes']['class'][] = 'btn-outline-primary'; $variables['attributes']['class']->addClass('btn-outline-' . $button_type); } else { $variables['attributes']['class'][] = 'btn-primary'; $variables['attributes']['class']->addClass('btn-' . $button_type); } } if ($button_size && empty(array_intersect($button_sizes, $variables['attributes']['class']))) { Loading config/install/bootstrap_barrio.settings.yml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ bootstrap_barrio_fluid_container: 0 # ---------------------------- bootstrap_barrio_button: 1 bootstrap_barrio_button_size: '' bootstrap_barrio_button_type: 'primary' bootstrap_barrio_button_outline: 0 # Navbar. Loading theme-settings.php +9 −0 Original line number Diff line number Diff line Loading @@ -289,6 +289,15 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#default_value' => theme_get_setting('bootstrap_barrio_button'), '#description' => t('There is a known issue where Ajax exposed filters do not if this setting is enabled.'), ]; $form['components']['buttons']['bootstrap_barrio_button_type'] = [ '#type' => 'select', '#title' => t('Default button type'), '#default_value' => theme_get_setting('bootstrap_barrio_button_type'), '#options' => [ 'primary' => t('Primary'), 'secondary' => t('Secondary'), ], ]; $form['components']['buttons']['bootstrap_barrio_button_size'] = [ '#type' => 'select', '#title' => t('Default button size'), Loading Loading
bootstrap_barrio.theme +5 −4 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ function bootstrap_barrio_preprocess_input(&$variables) { ]; $button_sizes = ['btn-sm', 'btn-lg']; $button_is_outline = theme_get_setting('bootstrap_barrio_button_outline'); $button_type = theme_get_setting('bootstrap_barrio_button_type'); if (is_object($variables['attributes']['class'])) { \Drupal::logger('bootstrap_barrio')->notice(implode($variables['attributes']['class']->value())); if (!in_array('btn', $variables['attributes']['class']->value())) { Loading @@ -713,10 +714,10 @@ function bootstrap_barrio_preprocess_input(&$variables) { } if (empty(array_intersect($button_types, $variables['attributes']['class']->value()))) { if ($button_is_outline) { $variables['attributes']['class']->addClass('btn-outline-primary'); $variables['attributes']['class']->addClass('btn-outline-' . $button_type); } else { $variables['attributes']['class']->addClass('btn-primary'); $variables['attributes']['class']->addClass('btn-' . $button_type); } } if ($button_size && empty(array_intersect($button_sizes, $variables['attributes']['class']->value()))) { Loading @@ -729,10 +730,10 @@ function bootstrap_barrio_preprocess_input(&$variables) { } if (empty(array_intersect($button_types, $variables['attributes']['class']))) { if ($button_is_outline) { $variables['attributes']['class'][] = 'btn-outline-primary'; $variables['attributes']['class']->addClass('btn-outline-' . $button_type); } else { $variables['attributes']['class'][] = 'btn-primary'; $variables['attributes']['class']->addClass('btn-' . $button_type); } } if ($button_size && empty(array_intersect($button_sizes, $variables['attributes']['class']))) { Loading
config/install/bootstrap_barrio.settings.yml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ bootstrap_barrio_fluid_container: 0 # ---------------------------- bootstrap_barrio_button: 1 bootstrap_barrio_button_size: '' bootstrap_barrio_button_type: 'primary' bootstrap_barrio_button_outline: 0 # Navbar. Loading
theme-settings.php +9 −0 Original line number Diff line number Diff line Loading @@ -289,6 +289,15 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#default_value' => theme_get_setting('bootstrap_barrio_button'), '#description' => t('There is a known issue where Ajax exposed filters do not if this setting is enabled.'), ]; $form['components']['buttons']['bootstrap_barrio_button_type'] = [ '#type' => 'select', '#title' => t('Default button type'), '#default_value' => theme_get_setting('bootstrap_barrio_button_type'), '#options' => [ 'primary' => t('Primary'), 'secondary' => t('Secondary'), ], ]; $form['components']['buttons']['bootstrap_barrio_button_size'] = [ '#type' => 'select', '#title' => t('Default button size'), Loading