From f5eb7f28dd0cc2d78df4430b8a4adf79fcaf7894 Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Wed, 30 Jun 2010 17:12:42 +0000 Subject: [PATCH] Add support for intermediate breadcrumbs in the template. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@116 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/themes/unl_wdn/html.tpl.php | 1 + sites/all/themes/unl_wdn/template.php | 16 ++++-- sites/all/themes/unl_wdn/theme-settings.php | 57 ++++++++++++++++----- 3 files changed, 57 insertions(+), 17 deletions(-) diff --git a/sites/all/themes/unl_wdn/html.tpl.php b/sites/all/themes/unl_wdn/html.tpl.php index 85eb110f..dfd532d8 100644 --- a/sites/all/themes/unl_wdn/html.tpl.php +++ b/sites/all/themes/unl_wdn/html.tpl.php @@ -38,6 +38,7 @@ $t->head .= PHP_EOL . $head . PHP_EOL . $styles . PHP_EOL . $scripts . PHP_EOL + . '<link href="' . url('<front>', array('absolute' => TRUE)) . '" rel="home" />' . PHP_EOL ; if (theme_get_setting('use_base')) { diff --git a/sites/all/themes/unl_wdn/template.php b/sites/all/themes/unl_wdn/template.php index fddf3caa..87356e73 100644 --- a/sites/all/themes/unl_wdn/template.php +++ b/sites/all/themes/unl_wdn/template.php @@ -19,20 +19,30 @@ require_once dirname(__FILE__) . '/includes/form.inc'; function unl_wdn_breadcrumb($variables) { $breadcrumbs = $variables['breadcrumb']; - + if (count($breadcrumbs) == 0) { - $breadcrumbs[] = unl_get_site_name_abbreviated(); + $breadcrumbs[] = '<a href="">' . unl_get_site_name_abbreviated() . '</a>'; } else { //Change 'Home' to be $site_name array_unshift($breadcrumbs, str_replace('Home', unl_get_site_name_abbreviated(), array_shift($breadcrumbs))); } + + //Add the intermediate breadcrumb if it exists + $intermediateBreadcrumbText = theme_get_setting('intermediate_breadcrumb_text'); + $intermediateBreadcrumbHref = theme_get_setting('intermediate_breadcrumb_href'); + if ($intermediateBreadcrumbText && $intermediateBreadcrumbHref) { + array_unshift($breadcrumbs, '<a href="' . $intermediateBreadcrumbHref . '">' . $intermediateBreadcrumbText . '</a>'); + } + //Prepend UNL array_unshift($breadcrumbs, '<a href="http://www.unl.edu/">UNL</a>'); //Append title of current page -- http://drupal.org/node/133242 - $breadcrumbs[] = drupal_get_title(); + if (!drupal_is_front_page()) { + $breadcrumbs[] = drupal_get_title(); + } $html = '<ul>' . PHP_EOL; foreach ($breadcrumbs as $breadcrumb) { diff --git a/sites/all/themes/unl_wdn/theme-settings.php b/sites/all/themes/unl_wdn/theme-settings.php index af12d0c9..fd65149c 100644 --- a/sites/all/themes/unl_wdn/theme-settings.php +++ b/sites/all/themes/unl_wdn/theme-settings.php @@ -2,24 +2,53 @@ function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state) { - $form['site_name_abbreviation'] = array( - '#type' => 'textfield', + $form[] = array( + '#type' => 'fieldset', '#title' => t('Site Name Abbreviation'), - '#default_value' => theme_get_setting('site_name_abbreviation'), - '#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.') + + 'site_name_abbreviation' => array( + '#type' => 'textfield', + '#default_value' => theme_get_setting('site_name_abbreviation'), + '#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.') + ) ); - $form['zen_forms'] = array( - '#type' => 'checkbox', - '#title' => t('Use Zen Forms'), - '#default_value' => theme_get_setting('zen_forms'), - '#description' => t('Transforms all forms into the list-based zen forms.') + $form['intermediate_breadcrumb'] = array( + '#type' => 'fieldset', + '#title' => t('Intermediate Breadcrumb'), + '#description' => t('A breadcrumb that is displayed between the UNL breadcrumb and this site\'s breadcrumb'), + + 'intermediate_breadcrumb_text' => array( + '#type' => 'textfield', + '#title' => t('Text'), + '#default_value' => theme_get_setting('intermediate_breadcrumb_text'), + '#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.') + ), + + 'intermediate_breadcrumb_href' => array( + '#type' => 'textfield', + '#title' => t('URL'), + '#default_value' => theme_get_setting('intermediate_breadcrumb_href'), + '#description' => t('An abbreviated version of your site\'s name to use in breadcrumbs.') + ) ); - $form['use_base'] = array( - '#type' => 'checkbox', - '#title' => t('Use HTML Base Tag in Head'), - '#default_value' => theme_get_setting('use_base'), - '#description' => t('Adds an HTML Base tag to the <head> section with href="' . url('<front>', array('absolute' => TRUE)) . '"') + $form['advanced_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced Settings'), + + 'zen_forms' => array( + '#type' => 'checkbox', + '#title' => t('Use Zen Forms'), + '#default_value' => theme_get_setting('zen_forms'), + '#description' => t('Transforms all forms into the list-based zen forms.') + ), + + 'use_base' => array( + '#type' => 'checkbox', + '#title' => t('Use HTML Base Tag in Head'), + '#default_value' => theme_get_setting('use_base'), + '#description' => t('Adds an HTML Base tag to the <head> section with href="' . url('<front>', array('absolute' => TRUE)) . '"') + ) ); } -- GitLab