diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme index de2f9c381f1e352765b30d6f25899d5b582a4d79..4e48744eab7ddd04cabbac1e588a84d18c4a930d 100644 --- a/bootstrap_barrio.theme +++ b/bootstrap_barrio.theme @@ -2,10 +2,11 @@ /** * @file - * Functions to support theming in the Bartik theme. + * Functions to support theming in the Bootstrap Barrio theme. */ use Drupal\Core\Template\Attribute; +use Drupal\Core\Link; /** * Implements hook_preprocess_HOOK() for HTML document templates. @@ -186,6 +187,11 @@ function bootstrap_barrio_preprocess_menu(&$variables) { } function bootstrap_barrio_preprocess_menu_local_task(&$variables) { + $link = $variables['element']['#link']; + $url = $link['url']; + $options = $url->getOptions(); + $url->setOptions($options + $link['localized_options']); + $variables['item'] = Link::fromTextAndUrl($link['title'], $url); } /** diff --git a/config/install/bootstrap_barrio.settings.yml b/config/install/bootstrap_barrio.settings.yml index 82ec7b883e6c5f974663e4a4039ef3cd6bd4db5b..104167418261a94688bb98dd6d08a1b3919fb4d7 100644 --- a/config/install/bootstrap_barrio.settings.yml +++ b/config/install/bootstrap_barrio.settings.yml @@ -19,6 +19,8 @@ bootstrap_barrio_button_outline: 0 # Navbar # -------------- +bootstrap_barrio_navbar_top_position: '' +bootstrap_barrio_navbar_top_inverse: 0 bootstrap_barrio_navbar_position: '' bootstrap_barrio_navbar_inverse: 0 @@ -72,8 +74,3 @@ bootstrap_barrio_tooltip_trigger: click: 0 bootstrap_barrio_tooltip_delay: 0 bootstrap_barrio_tooltip_container: 'body' - -# Global -# -------------- -bootstrap_barrio_toggle_name: 1 -bootstrap_barrio_toggle_search: 1 diff --git a/screenshot.png b/screenshot.png index 568cf563b91493b02de28d4dd7d23ac412703ac6..0a62690e3dd4ddc5f320c472451b6bf9944c860b 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/templates/navigation/menu--main.html.twig b/templates/navigation/menu--main.html.twig index 80ed262ec7bc70f50184b3b6748a18dd5bc5baa1..58919dc1a420cb423a8119acd21b1eca2f8237ad 100644 --- a/templates/navigation/menu--main.html.twig +++ b/templates/navigation/menu--main.html.twig @@ -45,11 +45,17 @@ ] %} <li{{ item.attributes.addClass(classes) }}> + {% + set link_classes = [ + not menu_level ? 'nav-link', + item.in_active_trail ? 'active', + ] + %} {% if item.below %} - {{ link(item.title, item.url, {'class': 'nav-link', 'data-target': '#', 'data-toggle': 'dropdown', 'aria-expanded': 'false'}) }} + {{ link(item.title, item.url, {'class': link_classes, 'data-target': '#', 'data-toggle': 'dropdown', 'aria-expanded': 'false'}) }} {{ menus.menu_links(item.below, attributes, menu_level + 1) }} {% else %} - {{ link(item.title, item.url, {'class': 'nav-link'}) }} + {{ link(item.title, item.url, {'class': link_classes}) }} {% endif %} </li> {% endfor %} diff --git a/templates/navigation/menu-local-task.html.twig b/templates/navigation/menu-local-task.html.twig index 981959dae0b6a53938b6459862320d0b17bf5d09..74d49187dc4fdffc981b813dc13992eaddcb3949 100644 --- a/templates/navigation/menu-local-task.html.twig +++ b/templates/navigation/menu-local-task.html.twig @@ -7,6 +7,8 @@ * - attributes: HTML attributes for the wrapper element. * - is_active: Whether the task item is an active tab. * - link: A rendered link element. + * - item.text: Text for the link + * - item.url: URL object for link * * Note: This template renders the content for each task item in * menu-local-tasks.html.twig. @@ -14,5 +16,10 @@ * @see template_preprocess_menu_local_task() */ #} -{{ dump(link) }} -<li{{ attributes.addClass(is_active ? 'active', 'nav-item') }}>{{ link }}</li> +{% + set classes = [ + 'nav-link', + is_active ? 'active', + ] +%} +<li{{ attributes.addClass(is_active ? 'active', 'nav-item') }}>{{ link(item.text, item.url, {'class': classes}) }}</li> diff --git a/theme-settings.php b/theme-settings.php index 15047d891ccab72030cbad828ff62812f945ff4b..0ddc3b7bd8ffbd729d5c9517743b6a826be2190e 100644 --- a/theme-settings.php +++ b/theme-settings.php @@ -3,7 +3,7 @@ * @file * theme-settings.php * - * Provides theme settings for Bootstrap based themes when admin theme is not. + * Provides theme settings for Bootstrap Barrio based themes when admin theme is not. * * @see ./includes/settings.inc */ @@ -28,7 +28,6 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte $form['theme_settings']['#open'] = FALSE; $form['logo']['#open'] = FALSE; $form['favicon']['#open'] = FALSE; - $form['bootstrap'] = array( '#type' => 'vertical_tabs', '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>', @@ -44,7 +43,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte //Container $form['layout']['container'] = array( - '#type' => 'fieldset', + '#type' => 'details', '#title' => t('Container'), '#collapsible' => TRUE, '#collapsed' => TRUE, @@ -60,7 +59,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte // Sidebar Position $form['layout']['sidebar_position'] = array( - '#type' => 'fieldset', + '#type' => 'details', '#title' => t('Sidebar Position'), '#collapsible' => TRUE, '#collapsed' => TRUE, @@ -89,7 +88,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte // Sidebar First $form['layout']['sidebar_first'] = array( - '#type' => 'fieldset', + '#type' => 'details', '#title' => t('Sidebar First Layout'), '#collapsible' => TRUE, '#collapsed' => TRUE, @@ -117,7 +116,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte // Sidebar Second $form['layout']['sidebar_second'] = array( - '#type' => 'fieldset', + '#type' => 'details', '#title' => t('Sidebar Second Layout'), '#collapsible' => TRUE, '#collapsed' => TRUE, @@ -145,7 +144,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte // Footer Layout $form['layout']['footer'] = array( - '#type' => 'fieldset', + '#type' => 'details', '#title' => t('Footer Layout'), '#collapsible' => TRUE, '#collapsed' => TRUE, @@ -249,6 +248,24 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#collapsible' => TRUE, '#collapsed' => TRUE, ); + $form['components']['navbar']['bootstrap_barrio_navbar_top_position'] = array( + '#type' => 'select', + '#title' => t('Navbar top position'), + '#description' => t('Select your navbar top position.'), + '#default_value' => theme_get_setting('bootstrap_barrio_navbar_top_position'), + '#options' => array( + 'static-top' => t('Static Top'), + 'fixed-top' => t('Fixed Top'), + 'fixed-bottom' => t('Fixed Bottom'), + ), + '#empty_option' => t('Normal'), + ); + $form['components']['navbar']['bootstrap_barrio_navbar_top_inverse'] = array( + '#type' => 'checkbox', + '#title' => t('Inverse navbar top style'), + '#description' => t('Select if you want the inverse navbar top style.'), + '#default_value' => theme_get_setting('bootstrap_barrio_navbar_top_inverse'), + ); $form['components']['navbar']['bootstrap_barrio_navbar_position'] = array( '#type' => 'select', '#title' => t('Navbar Position'), @@ -268,36 +285,6 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#default_value' => theme_get_setting('bootstrap_barrio_navbar_inverse'), ); - // Region wells. - $wells = array( - '' => t('None'), - 'well' => t('.well (normal)'), - 'well well-sm' => t('.well-sm (small)'), - 'well well-lg' => t('.well-lg (large)'), - ); - $form['components']['region_wells'] = array( - '#type' => 'details', - '#title' => t('Region wells'), - '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on !wells.', array( - '!wells' => \Drupal::l(t('Bootstrap Wells'), Url::fromUri('http://getbootstrap.com/components/#wells')), - )), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - // Get defined regions. - $regions = system_region_list('bootstrap'); - foreach ($regions as $name => $title) { - $form['components']['region_wells']['region_well-' . $name] = array( - '#title' => $title, - '#type' => 'select', - '#attributes' => array( - 'class' => array('input-sm'), - ), - '#options' => $wells, - '#default_value' => theme_get_setting('bootstrap_barrio_region_well-' . $name), - ); - } - // JavaScript settings. $form['javascript'] = array( '#type' => 'details', @@ -540,4 +527,5 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#description' => t('Appends the tooltip to a specific element. Example: "body"'), '#default_value' => theme_get_setting('bootstrap_barrio_tooltip_container'), ); + }