From 230ef65485f3648731d580b594375826e5a16759 Mon Sep 17 00:00:00 2001 From: Mark Carver Date: Tue, 3 Jan 2017 17:54:12 -0600 Subject: [PATCH] Issue #2839880 by markcarver, hass: Add date/calendar module template --- templates/date/date-views-pager.tpl.php | 36 +++++++++++ templates/date/date-views-pager.vars.php | 101 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 templates/date/date-views-pager.tpl.php create mode 100644 templates/date/date-views-pager.vars.php diff --git a/templates/date/date-views-pager.tpl.php b/templates/date/date-views-pager.tpl.php new file mode 100644 index 0000000..4266fa3 --- /dev/null +++ b/templates/date/date-views-pager.tpl.php @@ -0,0 +1,36 @@ + + + + +> + +

+ diff --git a/templates/date/date-views-pager.vars.php b/templates/date/date-views-pager.vars.php new file mode 100644 index 0000000..403ff2d --- /dev/null +++ b/templates/date/date-views-pager.vars.php @@ -0,0 +1,101 @@ + t('Previous', array(), array('context' => 'date_nav')), + 'next' => t('Next', array(), array('context' => 'date_nav')), + ); + + // Icon map. + $icons = array( + 'prev' => array( + 'name' => 'menu-left', + 'default' => '« ', + 'position' => 'before', + ), + 'next' => array( + 'name' => 'menu-right', + 'default' => ' »', + 'position' => 'after', + ), + ); + + // Create necessary links. + $items = []; + foreach ($types as $type => $text) { + $item_classes = array($type); + + $options = isset($variables[$type . '_options']) ? $variables[$type . '_options']: array(); + $options += array('attributes' => array()); + + $url = $variables[$type . '_url']; + // Make the item disabled if there is no URL. + if (!$url) { + $url = '#'; + $item_classes[] = 'disabled'; + $options['absolute'] = TRUE; + $options['external'] = TRUE; + } + // Convert titles into tooltips, if enabled. + elseif (!empty($options['attributes']['title']) && bootstrap_setting('tooltip_enabled')) { + $options['attributes']['data-toggle'] = 'tooltip'; + $options['attributes']['data-placement'] = 'bottom'; + } + + // Create a link. + $link = array( + '#theme' => 'link__date_views__pager__' . $type, + '#text' => $text, + '#path' => $url, + '#options' => $options, + ); + + // Add relevant icon. + if (isset($icons[$type])) { + $icon = $icons[$type]; + $link['#icon'] = _bootstrap_icon($icon['name'], $icon['default']); + $link['#icon_position'] = $mini ? 'icon_only' : $icon['position']; + } + + $items[$type] = array( + 'class' => $item_classes, + 'data' => $link, + ); + } + + // Add items render array. + $variables['items'] = array( + '#theme' => 'item_list__date_views__pager', + '#attributes' => array('class' => array('pagination', 'pull-right')), + '#items' => $items, + ); + + // Add default classes for the