diff --git a/STARTERKIT/STARTERKIT.info.txt b/STARTERKIT/STARTERKIT.info.txt index 57ddd35..0deb9e9 100644 --- a/STARTERKIT/STARTERKIT.info.txt +++ b/STARTERKIT/STARTERKIT.info.txt @@ -118,10 +118,14 @@ settings[zen_breadcrumb_separator] = ' › ' settings[zen_breadcrumb_home] = 1 settings[zen_breadcrumb_trailing] = 1 settings[zen_breadcrumb_title] = 0 -settings[zen_jump_link_target] = main-menu settings[zen_rebuild_registry] = 1 settings[zen_wireframes] = 0 +; Skip link defaults. You can delete these (or leave empty) if your design doesn't +; require a skip link. About skip links: http://drupal.org/node/467976 +settings[zen_skip_link_href] = main-menu +settings[zen_skip_link_text] = Skip to navigation + ; To make this sub-theme an admin theme with shortcut links next to titles, ; uncomment the line below. diff --git a/template.php b/template.php index 6b51ab8..ee9f383 100644 --- a/template.php +++ b/template.php @@ -210,7 +210,21 @@ function zen_preprocess_html(&$variables, $hook) { $variables['classes_array'][] = 'page-panels'; break; } - $variables['jump_link_target'] = theme_get_setting('zen_jump_link_target'); + + // Render the skip link. + $skip_link_href = theme_get_setting('zen_skip_link_href'); + $skip_link_text = theme_get_setting('zen_skip_link_text'); + $variables['skip_link'] = ''; + if ($skip_link_href && $skip_link_text) { + $variables['skip_link'] = l(t($skip_link_text), $_GET['q'], + array( + 'attributes' => array( + 'class' => array('element-invisible', 'element-focusable'), + ), + 'fragment' => $skip_link_href, + ) + ); + } } /** diff --git a/templates/html.tpl.php b/templates/html.tpl.php index 2f04b89..73a97cd 100644 --- a/templates/html.tpl.php +++ b/templates/html.tpl.php @@ -25,8 +25,8 @@ * - $styles: Style tags necessary to import all CSS files for the page. * - $scripts: Script tags necessary to load the JavaScript files and settings * for the page. - * - $jump_link_target: The HTML ID of the element that the "Jump to Navigation" - * link should jump to. Defaults to "main-menu". + * - $skip_link: Accessible-but-hidden skip link that should be printed at the + * top of each page. Empty if no link href or text is set in the theme settings. * - $page_top: Initial markup from any modules that have altered the * page. This variable should always be output first, before all other dynamic * content. @@ -70,9 +70,9 @@ > - + + + diff --git a/theme-settings.php b/theme-settings.php index 98d0371..cbcf5e4 100644 --- a/theme-settings.php +++ b/theme-settings.php @@ -86,12 +86,18 @@ function zen_form_system_theme_settings_alter(&$form, $form_state) { ), '#default_value' => theme_get_setting('zen_layout'), ); - $form['themedev']['zen_jump_link_target'] = array( + $form['themedev']['zen_skip_link_href'] = array( '#type' => 'textfield', - '#title' => t('Anchor ID for “Jump to Navigation” link'), - '#default_value' => theme_get_setting('zen_jump_link_target'), + '#title' => t('Anchor ID for the skip link'), + '#default_value' => theme_get_setting('zen_skip_link_href'), '#field_prefix' => '#', - '#description' => t('Specify the HTML ID of the main navigation menu; this will be used by the accessible-but-hidden “Jump to Navigation" link at the top of each page.'), + '#description' => t('The HTML ID of the element that the accessible-but-hidden skip link at the top of each page should link to. (About skip links)', array('!link' => 'http://drupal.org/node/467976')), + ); + $form['themedev']['zen_skip_link_text'] = array( + '#type' => 'textfield', + '#title' => t('Text for the skip link'), + '#default_value' => theme_get_setting('zen_skip_link_text'), + '#description' => t('For example: Skip to navigation, Skip to content'), ); $form['themedev']['zen_wireframes'] = array( '#type' => 'checkbox', diff --git a/zen.info b/zen.info index 4aa45c6..726f633 100644 --- a/zen.info +++ b/zen.info @@ -23,6 +23,7 @@ settings[zen_breadcrumb_home] = 1 settings[zen_breadcrumb_trailing] = 1 settings[zen_breadcrumb_title] = 0 settings[zen_layout] = zen-columns-liquid -settings[zen_jump_link_target] = main-menu settings[zen_rebuild_registry] = 0 settings[zen_wireframes] = 0 +settings[zen_skip_link_href] = main-menu +settings[zen_skip_link_text] = Skip to navigation