- <?php
- * @file
- * Basis preprocess functions and theme function overrides.
- */
-
- * Implements hook_css_alter().
- */
- function basis_css_alter(&$css) {
-
-
- if (config_get('menu.settings', 'menu_breakpoint') == 'custom') {
- $path = backdrop_get_path('theme', 'basis');
- unset($css[$path . '/css/component/menu-dropdown.css']);
- }
- }
-
- * Prepares variables for page templates.
- *
- * @see page.tpl.php
- */
- function basis_preprocess_page(&$variables) {
- $node = menu_get_object();
-
-
- backdrop_add_library('system', 'opensans', TRUE);
-
-
- if ($node) {
- $variables['classes'][] = 'page-node-' . $node->nid;
- }
-
-
- $view = views_get_page_view();
- if ($view) {
- $variables['classes'][] = 'view-name-' . $view->name;
- }
-
-
- $config = config('menu.settings');
- if ($config->get('menu_breakpoint') == 'custom') {
- backdrop_add_css(backdrop_get_path('theme', 'basis') . '/css/component/menu-dropdown.breakpoint.css', array(
- 'group' => CSS_THEME,
- 'every_page' => TRUE,
- ));
- backdrop_add_css(backdrop_get_path('theme', 'basis') . '/css/component/menu-dropdown.breakpoint-queries.css', array(
- 'group' => CSS_THEME,
- 'every_page' => TRUE,
- 'media' => 'all and (min-width: ' . $config->get('menu_breakpoint_custom') . ')',
- ));
- }
- }
-
- * Prepares variables for maintenance page templates.
- *
- * @see maintenance-page.tpl.php
- */
- function basis_preprocess_maintenance_page(&$variables) {
- $css_path = backdrop_get_path('theme', 'basis') . '/css/component/maintenance.css';
- backdrop_add_css($css_path);
- }
-
- * Prepares variables for layout templates.
- *
- * @see layout.tpl.php
- */
- function basis_preprocess_layout(&$variables) {
- if ($variables['is_front']) {
-
- $variables['classes'][] = 'layout-front';
-
- $original = $variables['theme_hook_original'];
- $variables['theme_hook_suggestions'][] = $original . '__front';
- $variables['theme_hook_suggestion'] = $original . '__front';
- }
- }
-
- * Prepares variables for node templates.
- *
- * @see node.tpl.php
- */
- function basis_preprocess_node(&$variables) {
- if ($variables['status'] == NODE_NOT_PUBLISHED) {
- $name = node_type_get_name($variables['type']);
- $variables['title_suffix']['unpublished_indicator'] = array(
- '#type' => 'markup',
- '#markup' => '<div class="unpublished-indicator">' . t('This @type is unpublished.', array('@type' => $name)) . '</div>',
- );
- }
- }
-
- * Prepares variables for header templates.
- *
- * @see header.tpl.php
- */
- function basis_preprocess_header(&$variables) {
- $logo = $variables['logo'];
- $logo_attributes = $variables['logo_attributes'];
-
-
- if ($logo) {
- $logo_wrapper_classes = array();
- $logo_wrapper_classes[] = 'header-logo-wrapper';
- if ($logo_attributes['width'] <= $logo_attributes['height']) {
- $logo_wrapper_classes[] = 'header-logo-tall';
- }
-
- $variables['logo_wrapper_classes'] = $logo_wrapper_classes;
- }
- }
-
- * Overrides theme_breadcrumb(). Removes » from markup.
- *
- * @see theme_breadcrumb().
- */
- function basis_breadcrumb($variables) {
- $breadcrumb = $variables['breadcrumb'];
- $output = '';
- if (!empty($breadcrumb)) {
- $output .= '<nav class="breadcrumb" aria-label="' . t('Website Orientation') . '">';
- $output .= '<ol><li>' . implode('</li><li>', $breadcrumb) . '</li></ol>';
- $output .= '</nav>';
- }
- return $output;
- }