' . $element['#children'] . '
';
+ }
+}
+
+/**
+ * Implements template_preprocess_HOOK().
+ */
+function template_preprocess_toolbar_tray_toggle(&$variables) {
+ // Provide an id, a data attribute linking each tab to the corresponding
+ // tray and ARIA information.
+ if (!isset($variables['options']['attributes'])) {
+ $variables['options']['attributes'] = array();
+ }
+ $variables['options']['attributes']['id'] = 'toolbar-tab-' . $variables['toolbar_identifier'];
+ $variables['options']['attributes']['data-toolbar-tray'] = $variables['toolbar_identifier'];
+ $variables['options']['attributes']['aria-owns'] = 'toolbar-tray-' . $variables['toolbar_identifier'];
+ $variables['options']['attributes']['role'] = 'button';
+ $variables['options']['attributes']['class'][] = 'trigger';
+ $variables['options']['attributes']['aria-pressed'] = 'false';
+}
+
+/**
+ * Returns HTML for toolbar tab that opens and closes a tray.
+ *
+ * Use in combination with theme_toolbar_tray_wrapper to create an
+ * association between a link tag in the administration bar and a tray.
+ *
+ * @param $variables
+ * An associative array containing the keys 'text', 'path', and 'options'. See
+ * the l() function for information about these variables.
+ *
+ * @see l()
+ */
+function theme_toolbar_tray_toggle(&$variables) {
+ return l($variables['text'], $variables['path'], $variables['options']);
+}
+
+/**
+ * Returns HTML for wrapping a toolbar tray.
+ *
+ * Used in combination with theme_toolbar_tray_toggle() to create an
+ * association between a link tag in the administration bar and a tray.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - element: An associative array containing the properties and children of
+ * the tray. Properties used: #children, #toolbar_identifier, #attributes
+ * and #heading.
+ */
+function theme_toolbar_tray_wrapper(&$variables) {
+ $element = $variables['element'];
+ if (!empty($element['#children'])) {
+ if (!empty($element['#toolbar_identifier'])) {
+ $group = $element['#toolbar_identifier'];
+ if (!isset($element['#attributes'])) {
+ $element['#attributes'] = array();
+ }
+ $element['#attributes'] += array(
+ 'id' => 'toolbar-tray-' . $group,
+ 'data-toolbar-tray' => $group,
+ 'aria-owned-by' => 'toolbar-tab-' . $group,
+ );
+ $element['#attributes']['class'][] = 'tray';
+ $element['#attributes']['class'][] = 'tray-' . $group;
+ $element['#attributes']['class'][] = 'overlay-displace-top';
+ }
+ // Print a heading in the tray if one exists.
+ $heading = (isset($element['#heading'])) ? '' . $heading . $variables['element']['#children'] . '
';
}
}
@@ -216,18 +306,18 @@ function toolbar_toolbar() {
// The 'Home' tab is a simple link, with no corresponding tray.
$items['home'] = array(
- 'tab' => array(
- '#title' => t('Home'),
- '#href' => '