当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_attributes函数代码示例

本文整理汇总了PHP中drupal_attributes函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_attributes函数的具体用法?PHP drupal_attributes怎么用?PHP drupal_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_attributes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: iconlabs_breadcrumb

/**
 * 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;
    }
}
开发者ID:delaneyceo,项目名称:iconlabs,代码行数:29,代码来源:template.php

示例2: bootstrap_menu_link

/**
 * 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";
}
开发者ID:estebanpcastro,项目名称:ColombiaNosUne,代码行数:35,代码来源:menu-link.func.php

示例3: elements_theme_links__system_main_menu

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;
}
开发者ID:Jax24135,项目名称:d740ftp,代码行数:60,代码来源:template.php

示例4: bootstrap_sst_textfield

/**
 * 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;
}
开发者ID:atssc-scdata,项目名称:bootstrap_sst,代码行数:35,代码来源:textfield.func.php

示例5: mortgagespeak_menu_link

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";
    }
}
开发者ID:snehal-addweb,项目名称:Mortgagespeak,代码行数:26,代码来源:template.php

示例6: commons_origins_menu_link

/**
 * 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>";
}
开发者ID:rexxllabore,项目名称:d7-commons-sanbox,代码行数:34,代码来源:template.php

示例7: tibco_styles_form_element_label

/**
 * 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";
}
开发者ID:JaspersoftMarketing,项目名称:design_guide,代码行数:32,代码来源:template.php

示例8: spanjestrijders_breadcrumb

/**
 * 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 '';
}
开发者ID:IISH,项目名称:drupal-theme-spanjestrijders,代码行数:49,代码来源:template.php

示例9: academy_delta_blocks_breadcrumb

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;
}
开发者ID:EWB,项目名称:grh,代码行数:28,代码来源:template.php

示例10: druio_theme_preprocess_druio_theme_header_links

/**
 * 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']);
    }
}
开发者ID:isaenkov,项目名称:Dru.io,代码行数:11,代码来源:template.php

示例11: qualiceutics__topbar_main_menu

/**
 * 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>';
}
开发者ID:CTH12,项目名称:qualiceutics,代码行数:11,代码来源:template.php

示例12: mdl_links__topbar_secondary_menu

/**
 * 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>';
}
开发者ID:zacdavidm,项目名称:mdl,代码行数:10,代码来源:template.php

示例13: theme_bootstrap_btn_dropdown

/**
 * 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;
}
开发者ID:arjunkumar786,项目名称:faces,代码行数:32,代码来源:bootstrap-btn-dropdown.func.php

示例14: bootstrap_psdpt_form_element_label

/**
 * 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";
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:37,代码来源:form-element-label.func.php

示例15: bootstrap_process_bootstrap_modal

/**
 * 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']);
}
开发者ID:drupdateio,项目名称:gvj,代码行数:16,代码来源:bootstrap-modal.vars.php


注:本文中的drupal_attributes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。