Пример #1
0
/**
 * Implements theme_breadcrumb().
 */
function iconlabs_breadcrumb(&$variables)
{
    $output = '';
    if (!empty($variables['breadcrumb'])) {
        $output = '<div id="breadcrumb" class="breadcrumb-container clearfix"><h2 class="element-invisible">You are here</h2><ul class="breadcrumb">';
        $switch = array('odd' => 'even', 'even' => 'odd');
        $zebra = 'even';
        $last = count($variables['breadcrumb']) - 1;
        $seperator = '<span class="breadcrumb-seperator">&#187;</span>';
        foreach ($variables['breadcrumb'] as $key => $item) {
            $zebra = $switch[$zebra];
            $attributes['class'] = array('depth-' . ($key + 1), $zebra);
            if ($key == 0) {
                $attributes['class'][] = 'first';
            }
            if ($key == $last) {
                $attributes['class'][] = 'last';
                $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . '';
            } else {
                $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . $seperator;
            }
        }
        $output .= '</ul></div>';
        return $output;
    }
}
/**
 * Overrides theme_menu_link().
 */
function bootstrap_menu_link(array $variables)
{
    $element = $variables['element'];
    $sub_menu = '';
    if ($element['#below']) {
        // Prevent dropdown functions from being added to management menu so it
        // does not affect the navbar module.
        if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
            $sub_menu = drupal_render($element['#below']);
        } elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] >= 1) {
            // Add our own wrapper.
            unset($element['#below']['#theme_wrappers']);
            $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
            // Generate as standard dropdown.
            //$element['#title'] .= ' <span class="caret"></span>';
            $element['#attributes']['class'][] = 'dropdown';
            $element['#localized_options']['html'] = TRUE;
            // Set dropdown trigger element to # to prevent inadvertant page loading
            // when a submenu link is clicked.
            //$element['#localized_options']['attributes']['data-target'] = '#';
            $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
            //$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
        }
    }
    // On primary navigation menu, class 'active' is not set on active menu item.
    // @see https://drupal.org/node/1896674
    if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && empty($element['#localized_options']['language'])) {
        $element['#attributes']['class'][] = 'active';
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
Пример #3
0
function elements_theme_links__system_main_menu($variables)
{
    $links = $variables['links'];
    $attributes = $variables['attributes'];
    $heading = $variables['heading'];
    global $language_url;
    $output = '';
    if (count($links) > 0) {
        $output = '';
        // Treat the heading first if it is present to prepend it to the
        // list of links.
        if (!empty($heading)) {
            if (is_string($heading)) {
                // Prepare the array that will be used when the passed heading
                // is a string.
                $heading = array('text' => $heading, 'level' => 'h2');
            }
            $output .= '<' . $heading['level'];
            if (!empty($heading['class'])) {
                $output .= drupal_attributes(array('class' => $heading['class']));
            }
            $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
        }
        $output .= '<div id="pages">';
        $num_links = count($links);
        $i = 1;
        foreach ($links as $key => $link) {
            $class = array($key);
            // Add first, last and active classes to the list of links to help out themers.
            if ($i == 1) {
                $class[] = 'first';
            }
            if ($i == $num_links) {
                $class[] = 'last';
            }
            if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language_url->language)) {
                $class[] = 'active';
            }
            $output .= '<span class="menu-items"><h3>';
            if (isset($link['href'])) {
                // Pass in $link as $options, they share the same keys.
                $output .= l($link['title'], $link['href'], $link);
            } elseif (!empty($link['title'])) {
                // Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
                if (empty($link['html'])) {
                    $link['title'] = check_plain($link['title']);
                }
                $span_attributes = '';
                if (isset($link['attributes'])) {
                    $span_attributes = drupal_attributes($link['attributes']);
                }
                $output .= '<h3' . $span_attributes . '>' . $link['title'] . '</h3><span>' . $link['attributes']['title'] . '</span';
            }
            $i++;
            $output .= "</h3>" . $link['attributes']['title'] . "</span>\n";
        }
        $output .= '</div>';
    }
    return $output;
}
Пример #4
0
/**
 * Overrides theme_textfield().
 */
function bootstrap_sst_textfield($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'text';
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
    _form_set_class($element, array('form-text'));
    $output = '<input' . drupal_attributes($element['#attributes']) . ' />';
    $extra = '';
    if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
        drupal_add_library('system', 'drupal.autocomplete');
        $element['#attributes']['class'][] = 'form-autocomplete';
        $attributes = array();
        $attributes['type'] = 'hidden';
        $attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
        $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
        $attributes['disabled'] = 'disabled';
        $attributes['class'][] = 'autocomplete';
        // Uses icon for autocomplete "throbber".
        if ($icon = _bootstrap_icon('refresh')) {
            $output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>';
        } else {
            $output = '<div class="input-group">' . $output . '<span class="input-group-addon">';
            // The throbber's background image must be set here because sites may not
            // be at the root of the domain (ie: /) and this value cannot be set via
            // CSS.
            $output .= '<span class="autocomplete-throbber" style="background-image:url(' . url('misc/throbber.gif') . ')"></span>';
            $output .= '</span></div>';
        }
        $extra = '<input' . drupal_attributes($attributes) . ' />';
    }
    return $output . $extra;
}
Пример #5
0
function mortgagespeak_menu_link(array $variables)
{
    global $user;
    $show_purple_tooltip = 0;
    $user_info = user_load($user->uid);
    if (isset($user_info->field_show_got_it_box) && !empty($user_info->field_show_got_it_box)) {
        $show_purple_tooltip = $user_info->field_show_got_it_box['und'][0]['value'];
    }
    $sub_menu = '';
    $element = $variables['element'];
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    $variables['element']['#attributes']['class'][] = 'active';
    $variables['element']['#localized_options']['attributes']['class'][] = 'active';
    $output = l($element['#title'], $element['#href'], $options = $element['#localized_options']);
    if ($show_purple_tooltip == 1) {
        if ($element['#original_link']['menu_name'] == 'main-menu' && $element['#href'] == 'my-page/tracked-news') {
            return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . "<div id='purple-tooltip' class='purple-main-container'><div class='purple-inner'><div class='purple-text'>Access your Custom News Page here.</div><div class='purple-button'>ok, Got it</div></div></div></li>\n";
        } else {
            return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
        }
    } else {
        return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
    }
}
Пример #6
0
/**
 * Implements theme_menu_link().
 */
function commons_origins_menu_link($vars)
{
    $output = '';
    $path_to_at_core = drupal_get_path('theme', 'adaptivetheme');
    include_once $path_to_at_core . '/inc/get.inc';
    global $theme_key;
    $theme_name = $theme_key;
    $element = $vars['element'];
    commons_origins_menu_link_class($element);
    $sub_menu = '';
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    if (at_get_setting('extra_menu_classes', $theme_name) == 1 && !empty($element['#original_link'])) {
        if (!empty($element['#original_link']['depth'])) {
            $element['#attributes']['class'][] = 'menu-depth-' . $element['#original_link']['depth'];
        }
        if (!empty($element['#original_link']['mlid'])) {
            $element['#attributes']['class'][] = 'menu-item-' . $element['#original_link']['mlid'];
        }
    }
    if (at_get_setting('menu_item_span_elements', $theme_name) == 1 && !empty($element['#title'])) {
        $element['#title'] = '<span>' . $element['#title'] . '</span>';
        $element['#localized_options']['html'] = TRUE;
    }
    if (at_get_setting('unset_menu_titles', $theme_name) == 1 && !empty($element['#localized_options']['attributes']['title'])) {
        unset($element['#localized_options']['attributes']['title']);
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>";
}
Пример #7
0
/**
 * Implements theme_form_element_label().
 */
function tibco_styles_form_element_label($variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after') {
        $attributes['class'] = 'option';
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $help = '';
    if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
        $help = $element['#checkbox_suffix'];
    }
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
/**
 * Return a themed breadcrumb trail. (Taken from Zen)
 *
 * http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_menu_breadcrumb_alter/7
 * if ($breadcrumb[0]['href'] == '<front>') { $breadcrumb[0]['title'] = 'iish'; }
 * en ook breadcrumb op home
 *
 * @param $variables
 *   - title: An optional string to be used as a navigational heading to give
 *     context for breadcrumb links to screen-reader users.
 *   - title_attributes_array: Array of HTML attributes for the title. It is
 *     flattened into a string within the theme function.
 *   - breadcrumb: An array containing the breadcrumb links.
 * @return
 *   A string containing the breadcrumb output.
 */
function spanjestrijders_breadcrumb($variables)
{
    $breadcrumb = $variables['breadcrumb'];
    // Return the breadcrumb with separators.
    if (!empty($breadcrumb)) {
        $breadcrumb_separator = ' > ';
        $trailing_separator = $title = '';
        $item = menu_get_item();
        if (!empty($item['tab_parent'])) {
            // If we are on a non-default tab, use the tab's title.
            $title = check_plain($item['title']);
        } else {
            $title = drupal_get_title();
        }
        if ($title) {
            $trailing_separator = $breadcrumb_separator;
        }
        // Provide a navigational heading to give context for breadcrumb links to
        // screen-reader users.
        if (empty($variables['title'])) {
            $variables['title'] = t('You are here');
        }
        // Unless overridden by a preprocess function, make the heading invisible.
        if (!isset($variables['title_attributes_array']['class'])) {
            $variables['title_attributes_array']['class'][] = 'element-invisible';
        }
        $heading = '<h2' . drupal_attributes($variables['title_attributes_array']) . '>' . $variables['title'] . '</h2>';
        //    return '<div class="breadcrumb">' . $heading . implode($breadcrumb_separator, $breadcrumb) . $trailing_separator . $title . '</div>';
        return '<div class="breadcrumb">' . $heading . implode($breadcrumb_separator, $breadcrumb) . '</div>';
    }
    // Otherwise, return an empty string.
    return '';
}
Пример #9
0
function academy_delta_blocks_breadcrumb($variables)
{
    $output = '';
    if (!empty($variables['breadcrumb'])) {
        if ($variables['breadcrumb_current']) {
            $variables['breadcrumb'][] = l(drupal_get_title(), current_path(), array('html' => TRUE));
        }
        $output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
        $switch = array('odd' => 'even', 'even' => 'odd');
        $zebra = 'even';
        $last = count($variables['breadcrumb']) - 1;
        foreach ($variables['breadcrumb'] as $key => $item) {
            $zebra = $switch[$zebra];
            $attributes['class'] = array('depth-' . ($key + 1), $zebra);
            if ($key == 0) {
                $attributes['class'][] = 'first';
            }
            if ($key == $last) {
                $attributes['class'][] = 'last';
                $output .= '<li' . drupal_attributes($attributes) . $item . '</li>';
            } else {
                $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . ' <span class="breadcrumb-separator">&#xBB;</span> ';
            }
        }
        $output .= '</ul></div>';
    }
    return $output;
}
Пример #10
0
/**
 * Implements hook_preprocess_HOOK():druio_theme_header_links.
 * @param $variables
 */
function druio_theme_preprocess_druio_theme_header_links(&$variables)
{
    foreach ($variables['links'] as $key => $link) {
        $variables['links'][$key]['classes'] = 'link ' . implode(' ', $link['classes']);
        $variables['links'][$key]['attributes'] = drupal_attributes($link['attributes']);
    }
}
Пример #11
0
/**
 * Implements theme_links() targeting the main menu topbar.
 * Override base template, which would add the class of "left",which  we don't need
 */
function qualiceutics__topbar_main_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu')));
    $output = _zurb_foundation_links($links);
    return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
}
Пример #12
0
/**
 * Implements theme_links() targeting the secondary menu topbar.
 */
function mdl_links__topbar_secondary_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu')));
    $output = _mdl_links($links);
    return '<nav' . drupal_attributes($variables['attributes']) . '>' . $output . '</nav>';
}
/**
 * Implements theme_bootstrap_btn_dropdown().
 */
function theme_bootstrap_btn_dropdown($variables)
{
    $type_class = '';
    $sub_links = '';
    $variables['attributes']['class'][] = 'btn-group';
    // Type class.
    if (isset($variables['type'])) {
        $type_class .= ' btn-' . $variables['type'];
    } else {
        $type_class .= ' btn-default';
    }
    // Start markup.
    $output = '<div' . drupal_attributes($variables['attributes']) . '>';
    // Add as string if its not a link.
    if (is_array($variables['label'])) {
        $output .= l($variables['label']['title'], ${$variables}['label']['href'], $variables['label']);
    }
    $output .= '<a class="btn' . $type_class . ' dropdown-toggle" data-toggle="dropdown" href="#">';
    // It is a link, create one.
    if (is_string($variables['label'])) {
        $output .= check_plain($variables['label']);
    }
    if (is_array($variables['links'])) {
        $sub_links = theme('links', array('links' => $variables['links'], 'attributes' => array('class' => array('dropdown-menu'))));
    }
    // Finish markup.
    $output .= '<span class="caret"></span></a>' . $sub_links . '</div>';
    return $output;
}
/**
 * Overrides theme_form_element_label().
 */
function bootstrap_psdpt_form_element_label(&$variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Determine if certain things should skip for checkbox or radio elements.
    $skip = isset($element['#type']) && ('checkbox' === $element['#type'] || 'radio' === $element['#type']);
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '' && !$skip) && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after' && !$skip) {
        $attributes['class'][] = $element['#type'];
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'][] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    // Insert radio and checkboxes inside label elements.
    $output = '';
    if (isset($variables['#children'])) {
        $output .= $variables['#children'];
    }
    // Append label.
    $output .= $t('!title !required', array('!title' => $title, '!required' => $required));
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
Пример #15
0
/**
 * Processes variables for the "bootstrap_modal" theme hook.
 *
 * See template for list of available variables.
 *
 * @see bootstrap-modal.tpl.php
 *
 * @ingroup theme_process
 */
function bootstrap_process_bootstrap_modal(&$variables)
{
    $variables['attributes'] = drupal_attributes($variables['attributes']);
    $variables['dialog_attributes'] = drupal_attributes($variables['dialog_attributes']);
    $variables['body'] = render($variables['body']);
    $variables['footer'] = render($variables['footer']);
}
Пример #16
0
/**
 * Overrides theme_file_managed_file().
 */
function springy_file_managed_file($variables)
{
    $element = $variables['element'];
    $attributes = array();
    if (isset($element['#id'])) {
        $attributes['id'] = $element['#id'];
    }
    if (!empty($element['#attributes']['class'])) {
        $attributes['class'] = (array) $element['#attributes']['class'];
    }
    $attributes['class'][] = 'form-managed-file';
    $attributes['class'][] = 'input-group';
    $element['upload_button']['#prefix'] = '<span class="input group-btn">';
    $element['upload_button']['#suffix'] = '</span>';
    $element['remove_button']['#prefix'] = '<span class="input group-btn">';
    $element['remove_button']['#suffix'] = '</span>';
    if (!empty($element['filename'])) {
        $element['filename']['#prefix'] = '<div class="form-control">';
        $element['filename']['#suffix'] = '</div>';
    }
    $hidden_elements = array();
    foreach (element_children($element) as $child) {
        if ($element[$child]['#type'] === 'hidden') {
            $hidden_elements[$child] = $element[$child];
            unset($element[$child]);
        }
    }
    // This wrapper is required to apply JS behaviors and CSS styling.
    $output = '';
    $output .= '<div' . drupal_attributes($attributes) . '>';
    $output .= drupal_render_children($element);
    $output .= '</div>';
    $output .= render($hidden_elements);
    return $output;
}
Пример #17
0
/**
 * Returns HTML for menu link.
 */
function boot_press_menu_link(array $variables)
{
    $element = $variables['element'];
    $sub_menu = '';
    if ($element['#below']) {
        if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
            $sub_menu = drupal_render($element['#below']);
        } else {
            unset($element['#below']['#theme_wrappers']);
            $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
            $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
            $element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
            if (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] > 1) {
                $element['#attributes']['class'][] = 'dropdown-submenu';
            } else {
                $element['#attributes']['class'][] = 'dropdown';
                $element['#localized_options']['html'] = TRUE;
                $element['#title'] .= ' <span class="caret"></span>';
            }
            $element['#localized_options']['attributes']['data-target'] = '#';
        }
    }
    if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
        $element['#attributes']['class'][] = 'active';
    }
    $menu_output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $menu_output . $sub_menu . "</li>\n";
}
Пример #18
0
/**
 * Implements hook_process().
 */
function alpha_process(&$vars, $hook)
{
    if (!empty($vars['elements']['#grid']) || !empty($vars['elements']['#data']['wrapper_css'])) {
        if (!empty($vars['elements']['#grid'])) {
            foreach (array('prefix', 'suffix', 'push', 'pull') as $quality) {
                if (!empty($vars['elements']['#grid'][$quality])) {
                    array_unshift($vars['attributes_array']['class'], $quality . '-' . $vars['elements']['#grid'][$quality]);
                }
            }
            array_unshift($vars['attributes_array']['class'], 'grid-' . $vars['elements']['#grid']['columns']);
        }
        if (!empty($vars['elements']['#data']['wrapper_css'])) {
            foreach (array_map('drupal_html_class', explode(' ', $vars['elements']['#data']['wrapper_css'])) as $class) {
                $vars['attributes_array']['class'][] = $class;
            }
        }
        $vars['attributes'] = $vars['attributes_array'] ? drupal_attributes($vars['attributes_array']) : '';
    }
    if (!empty($vars['elements']['#grid_container']) || !empty($vars['elements']['#data']['css'])) {
        if (!empty($vars['elements']['#data']['css'])) {
            foreach (array_map('drupal_html_class', explode(' ', $vars['elements']['#data']['css'])) as $class) {
                $vars['content_attributes_array']['class'][] = $class;
            }
        }
        if (!empty($vars['elements']['#grid_container'])) {
            $vars['content_attributes_array']['class'][] = 'container-' . $vars['elements']['#grid_container'];
        }
        $vars['content_attributes'] = $vars['content_attributes_array'] ? drupal_attributes($vars['content_attributes_array']) : '';
    }
    alpha_invoke('process', $hook, $vars);
}
Пример #19
0
/**
 * Implements hook_menu_link().
 */
function cignaGlobal_menu_link($variables)
{
    $element = $variables['element'];
    $sub_menu = '';
    /*if ($element['#below']) {
          $sub_menu = drupal_render($element['#below']);
      }*/
    unset($element['#attributes']['class']);
    unset($element['#attributes']['title']);
    if (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] == 1) {
        // Add our own wrapper.
        unset($element['#below']['#theme_wrappers']);
        $sub_menu = '<ul class="dropdown-menu" role="menu">' . drupal_render($element['#below']) . '</ul>';
        // Generate as standard dropdown.
        $element['#title'] = '<span class="fa fa-globe"> </span><span class="language">' . t('Language') . ' : </span>' . $element['#title'] . ' <span class="caret"></span>';
        $element['#attributes']['class'][] = 'dropdown';
        $element['#localized_options']['html'] = TRUE;
        $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
        $element['#localized_options']['attributes']['role'] = 'button';
        $element['#localized_options']['attributes']['aria-expanded'] = 'false';
        $element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
Пример #20
0
/**
 * Theme override function to output bootstrap-style textfield.
 * This is a workaround for the issue that bootstrap_element_info_alter
 * can be skipped due to theme not yet being initialized when drupal_alter
 * call made.
 *
 * @ingroup themeable
 * @see theme_textfield
 */
function cignaglobal_textfield($vars)
{
    $element = $vars['element'];
    $element['#attributes']['type'] = 'text';
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
    // Add form-control class if it does not exist.
    $classes = array('form-text');
    if (!isset($element['#attributes']['class']) || !in_array('form-control', $element['#attributes']['class'])) {
        $classes[] = 'form-control';
    }
    _form_set_class($element, $classes);
    $extra = '';
    if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) {
        drupal_add_library('system', 'drupal.autocomplete');
        $element['#attributes']['class'][] = 'form-autocomplete';
        $attributes = array();
        $attributes['type'] = 'hidden';
        $attributes['id'] = $element['#autocomplete_input']['#id'];
        $attributes['value'] = $element['#autocomplete_input']['#url_value'];
        $attributes['disabled'] = 'disabled';
        $attributes['class'][] = 'autocomplete';
        $extra = '<input' . drupal_attributes($attributes) . ' />';
    }
    $output = '<input' . drupal_attributes($element['#attributes']) . ' />';
    return $output . $extra;
}
Пример #21
0
/**
 * Implements template_preprocess_html().
 */
function glisseo_preprocess_html(&$variables)
{
    // HTML Attributes
    $html_attributes = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    $variables['html_attributes'] = drupal_attributes($html_attributes);
    // RDF namespaces.
    if ($variables['rdf_namespaces']) {
        $prefixes = array();
        foreach (explode("\n  ", ltrim($variables['rdf_namespaces'])) as $namespace) {
            $prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
        }
        $variables['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
    }
    // Add template suggestions for 404 and 403 errors.
    // F.e.: html--404.tpl.php
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['theme_hook_suggestions'][] = 'html__404';
        $variables['classes_array'][] = drupal_html_class('page-404');
    }
    if ($status == "403 Forbidden") {
        $variables['theme_hook_suggestions'][] = 'html__403';
        $variables['classes_array'][] = drupal_html_class('page-403');
    }
}
function webspark_seven_form_required_marker($variables)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array('class' => 'form-required', 'title' => $t('This field is required.'));
    return '<span' . drupal_attributes($attributes) . '> * </span>';
}
Пример #23
0
function neb_blockify_page_title($variables)
{
    if ($variables['page_title'] !== '') {
        $title_attributes_array = array();
        $title_attributes = drupal_attributes($title_attributes_array);
        return '<h1' . $title_attributes . '>' . $variables['page_title'] . '</h1>';
    }
}
Пример #24
0
/**
 * Processes variables for the "html" theme hook.
 *
 * See template for list of available variables.
 *
 * @see html.tpl.php
 *
 * @ingroup theme_process
 */
function d4s_bootstrap_process_html(&$variables)
{
    $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
    $variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']);
    $variables['page_top'] = Accessibility_for_taiwan($variables['page_top']);
    $variables['page_bottom'] = Accessibility_for_taiwan($variables['page_bottom']);
    $variables['page'] = Accessibility_for_taiwan($variables['page']);
}
Пример #25
0
/**
 * Implements theme_links() targeting the secondary menu topbar.
 */
function drupalcampbelgium_links__topbar_secondary_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu')));
    $output = _zurb_foundation_links($links);
    $variables['attributes']['class'][] = 'center-buttons';
    return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
}
Пример #26
0
/**
 * Implements hook_preprocess_html().
 */
function bthap_process_html(&$vars)
{
    // Aggragate the usual attributes that are placed in the html tag into a
    // single variable. Classes should not be added to this array since
    // contextual classes will be applied conditionally by the browser.
    $html_attributes = array('xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => $vars['language']->language, 'lang' => $vars['language']->language, 'version' => 'XHTML+RDFa 1.0', 'dir' => $vars['language']->dir);
    $vars['html_attributes'] = drupal_attributes($html_attributes) . $vars['rdf_namespaces'];
}
Пример #27
0
function framework_links($links, $attributes = array('class' => 'links'), $heading = '')
{
    global $language;
    $output = '';
    if (count($links) > 0) {
        // Treat the heading first if it is present to prepend it to the
        // list of links.
        if (!empty($heading)) {
            if (is_string($heading)) {
                // Prepare the array that will be used when the passed heading
                // is a string.
                $heading = array('text' => $heading, 'level' => 'h2');
            }
            $output .= '<' . $heading['level'];
            if (!empty($heading['class'])) {
                $output .= drupal_attributes(array('class' => $heading['class']));
            }
            $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
        }
        $output .= '<ul' . drupal_attributes($attributes) . '>';
        $num_links = count($links);
        $i = 1;
        foreach ($links as $key => $link) {
            $class = $key;
            // Add first, last and active classes to the list of links to help out themers.
            if ($i == 1) {
                $class .= ' first';
            }
            if ($i == $num_links) {
                $class .= ' last';
            }
            if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language->language)) {
                $class .= ' active';
            }
            $output .= '<li' . drupal_attributes(array('class' => $class)) . '>';
            if (isset($link['href'])) {
                // Pass in $link as $options, they share the same keys.
                $output .= l($link['title'], $link['href'], $link);
            } else {
                if (!empty($link['title'])) {
                    // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
                    if (empty($link['html'])) {
                        $link['title'] = check_plain($link['title']);
                    }
                    $span_attributes = '';
                    if (isset($link['attributes'])) {
                        $span_attributes = drupal_attributes($link['attributes']);
                    }
                    $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';
                }
            }
            $i++;
            $output .= "</li>\n";
        }
        $output .= '</ul>';
    }
    return $output;
}
Пример #28
0
/**
 * Return themed links.
 * Creates the type of delimiter used for $links
 */
function flower_links($links, $attributes = array('class' => 'links'))
{
    $output = '';
    $is_front = drupal_is_front_page();
    if (count($links) > 0) {
        $num_links = count($links);
        $i = 1;
        $output = '<ul class="' . $attributes['class'] . '">';
        foreach ($links as $key => $link) {
            $class = '';
            // Automatically add a class to each link and also to each LI
            if (isset($link['attributes']) && isset($link['attributes']['class'])) {
                $link['attributes']['class'] .= ' ' . $key;
                $class = $key;
            } else {
                if ($i == 1 && $is_front) {
                    $link['attributes']['class'] = $key . '-active active';
                    $class = $key . '-active';
                } else {
                    $link['attributes']['class'] = $key;
                    $class = $key;
                }
            }
            // Add first and last classes to the list of links to help out themers.
            $extra_class = '';
            if ($i == 1) {
                $extra_class .= 'first ';
            } else {
                // $output .= '&nbsp;| &nbsp;';
            }
            if ($i == $num_links) {
                $extra_class .= 'last ';
            }
            $output .= '<li class="' . $extra_class . $class . '">';
            // Is the title HTML?
            $html = isset($link['html']) && $link['html'];
            // Initialize fragment and query variables.
            $link['query'] = isset($link['query']) ? $link['query'] : NULL;
            $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
            if (isset($link['href'])) {
                $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
            } else {
                if ($link['title']) {
                    //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
                    if (!$html) {
                        $link['title'] = check_plain($link['title']);
                    }
                    $output .= '<li' . drupal_attributes($link['attributes']) . '>' . $link['title'] . '</li>';
                }
            }
            $i++;
            $output .= "</li>\n";
        }
        $output .= "</ul>";
    }
    return $output;
}
Пример #29
0
/**
* Override theme_links to include <span> in list.
*/
function theme221_links($links, $attributes = array('class' => 'links'))
{
    $output = '';
    if (count($links) > 0) {
        $output = '<ul' . drupal_attributes($attributes) . '>';
        $num_links = count($links);
        $i = 1;
        foreach ($links as $key => $link) {
            $class = '';
            // Automatically add a class to each link and also to each LI
            if (isset($link['attributes']) && isset($link['attributes']['class'])) {
                $link['attributes']['class'] .= ' ' . $key;
                $class = $key;
            } else {
                $link['attributes']['class'] = $key;
                $class = $key;
            }
            // Add first and last classes to the list of links to help out themers.
            $extra_class = '';
            if ($i == 1) {
                $extra_class .= 'first ';
            }
            if ($i == $num_links) {
                $extra_class .= 'last ';
            }
            // Add class active to active li
            $current = '';
            if (strstr($class, 'active')) {
                $current = ' active';
            }
            $output .= '<li class="' . $extra_class . $class . $current . '">';
            // Is the title HTML?
            $html = isset($link['html']) && $link['html'];
            // Initialize fragment and query variables.
            $link['query'] = isset($link['query']) ? $link['query'] : NULL;
            $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
            if (isset($link['href'])) {
                $spanned_title = "<span " . drupal_attributes($link['attributes']) . "><span>" . $link['title'] . "</span></span>";
                // In the line above, you could take out the drupal_attributes var and specify your class
                $output .= theme221_l($spanned_title, $link['href'], $link['attributes'], $link['query'], $link['fragment']);
            } else {
                if ($link['title']) {
                    //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
                    if (!$html) {
                        $link['title'] = check_plain($link['title']);
                    }
                    $output .= '<span' . drupal_attributes($link['attributes']) . '>' . $link['title'] . '</span>';
                }
            }
            $i++;
            $output .= "</li>\n";
        }
        $output .= '</ul>';
    }
    return $output;
}
Пример #30
0
function customTheme_user_listing($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    $email = $variables['email'];
    $uid = $variables['ID'];
    // Only output the list container and title, if there are any list items.
    // Check to see whether the block title exists before adding a header.
    // Empty headers are not semantic and present accessibility challenges.
    $output = '<div class="user_listing">';
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . 'List of all the users' . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        foreach ($items as $i => $item) {
            $attributes = array();
            $children = array();
            $data = '';
            if (is_array($item)) {
                $i = 0;
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                // Render nested list.
                $data .= theme_user_listing(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            if ($i == 0) {
                $attributes['class'][] = 'first';
            }
            if ($i == $num_items - 1) {
                $attributes['class'][] = 'last';
            }
            $attributes['class'][] = 'list_items';
            $output .= '<li' . drupal_attributes($attributes) . '><a href="/user/' . $uid[$i] . '#overlay-context=list/users' . '" >' . $data . "</a></li>\n";
            $output .= '<p>eeeeeemail - ' . $email[$i] . '</p>';
            $i++;
        }
        $output .= "</{$type}>";
    }
    $output .= '</div>';
    return $output;
}