• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bootstrap_setting函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bootstrap_preprocess_input

/**
 * Preprocess input.
 */
function bootstrap_preprocess_input(&$variables)
{
    $element =& $variables['element'];
    $attributes = new Attribute($variables['attributes']);
    // Set the element's attributes.
    \Drupal\Core\Render\Element::setAttributes($element, array('id', 'name', 'value', 'type'));
    // Handle button inputs.
    if (_bootstrap_is_button($element)) {
        $variables['attributes']['class'][] = 'btn';
        _bootstrap_colorize_button($variables);
        _bootstrap_iconize_button($element);
        // Add button size, if necessary.
        if ($size = bootstrap_setting('button_size')) {
            $variables['attributes']['class'][] = $size;
        }
        // Add in the button type class.
        $variables['attributes']['class'][] = 'form-' . $element['#type'];
        $variables['label'] = $element['#value'];
    }
    _bootstrap_prerender_input($variables);
    // Autocomplete fields.
    if (!empty($element['#autocomplete_route_name']) && Drupal::PathValidator($element['#autocomplete_route_name'])) {
        $variables['autocomplete'] = TRUE;
        // Attributes for hidden input field.
        $autocomplete_attributes = new Attribute();
        $autocomplete_attributes['type'] = 'hidden';
        $autocomplete_attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
        $autocomplete_attributes['value'] = Drupal::Url($element['#autocomplete_route_name'], $element['#autocomplete_route_parameters']);
        $autocomplete_attributes['disabled'] = 'disabled';
        $autocomplete_attributes['class'] = 'autocomplete';
        // Uses icon for autocomplete "throbber".
        $icon = _bootstrap_icon('refresh');
        // Fallback to using core's throbber.
        if (empty($icon)) {
            $icon = array('#type' => 'container', '#attributes' => array('class' => array('ajax-progress', 'ajax-progress-throbber', 'invisible')), 'throbber' => array('#type' => 'html_tag', '#tag' => 'div', '#attributes' => array('class' => array('throbber'))));
        }
        $variables['autocomplete_icon'] = $icon;
        $variables['autocomplete_attributes'] = $autocomplete_attributes;
    }
    // Search fields.
    if ($element['#type'] == 'search') {
        $attributes['placeholder'] = t('Search');
        $attributes['data-original-title'] = t('Enter the terms you wish to search for.');
    }
    // Additional Twig variables.
    $variables['icon'] = $element['#icon'];
    $variables['element'] = $element;
}
开发者ID:sathishRio,项目名称:themes,代码行数:51,代码来源:input.vars.php


示例2: bootstrap_preprocess_region

/**
 * Pre-processes variables for the "region" theme hook.
 *
 * See template for list of available variables.
 *
 * @see region.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_region(&$variables)
{
    $region = $variables['elements']['#region'];
    $variables['region'] = $region;
    $variables['content'] = $variables['elements']['#children'];
    $theme = \Drupal::theme()->getActiveTheme()->getName();
    // Content region.
    if ($region === 'content') {
        // @todo is this actually used properly?
        $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
    } elseif ($region === 'help' && !empty($variables['content'])) {
        $content = $variables['content'];
        $variables['content'] = array('icon' => array('#markup' => _bootstrap_icon('question-sign')), 'content' => array('#markup' => $content));
        $variables['attributes']['class'][] = 'alert';
        $variables['attributes']['class'][] = 'alert-info';
        $variables['attributes']['class'][] = 'messages';
        $variables['attributes']['class'][] = 'info';
    }
    // Support for "well" classes in regions.
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = bootstrap_setting('region_well-' . $name);
        }
    }
    if (!empty($wells[$region])) {
        $variables['attributes']['class'][] = $wells[$region];
    }
}
开发者ID:sathishRio,项目名称:themes,代码行数:38,代码来源:region.vars.php


示例3: bootstrap_preprocess_image_srcset

/**
 * Implements hook_preprocess_image_srcset().
 */
function bootstrap_preprocess_image_srcset(&$variables)
{
    // Add image shape, if necessary.
    if ($shape = bootstrap_setting('image_shape')) {
        $variables['attributes']['class'][] = $shape;
    }
}
开发者ID:lcube45,项目名称:hyx,代码行数:10,代码来源:image-srcset.vars.php


示例4: bootstrap_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function bootstrap_preprocess_region(&$variables)
{
    global $theme;
    $region = $variables['region'];
    $classes =& $variables['classes_array'];
    // Content region.
    if ($region === 'content') {
        // @todo is this actually used properly?
        $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
    } elseif ($region === 'help' && !empty($variables['content'])) {
        $variables['content'] = _bootstrap_icon('question-sign') . $variables['content'];
        $classes[] = 'alert';
        $classes[] = 'alert-info';
        $classes[] = 'messages';
        $classes[] = 'info';
    }
    // Support for "well" classes in regions.
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = bootstrap_setting('region_well-' . $name);
        }
    }
    if (!empty($wells[$region])) {
        $classes[] = $wells[$region];
    }
}
开发者ID:lcube45,项目名称:hyx,代码行数:30,代码来源:region.vars.php


示例5: bootstrap_preprocess_picture

/**
 * Pre-processes variables for the "picture" theme hook.
 *
 * See theme function for list of available variables.
 *
 * @see theme_picture()
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_picture(&$variables)
{
    // Add responsiveness, if necessary.
    if ($shape = bootstrap_setting('image_responsive')) {
        $variables['attributes']['class'][] = 'img-responsive';
    }
}
开发者ID:sodacrackers,项目名称:washyacht,代码行数:16,代码来源:picture.vars.php


示例6: bootstrap_preprocess_html

/**
 * Pre-processes variables for the "html" theme hook.
 *
 * See template for list of available variables.
 *
 * @see html.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_html(&$variables)
{
    // Backport from Drupal 8 RDFa/HTML5 implementation.
    // @see https://www.drupal.org/node/1077566
    // @see https://www.drupal.org/node/1164926
    // HTML element attributes.
    $variables['html_attributes_array'] = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    // Override existing RDF namespaces to use RDFa 1.1 namespace prefix bindings.
    if (function_exists('rdf_get_namespaces')) {
        $rdf = array('prefix' => array());
        foreach (rdf_get_namespaces() as $prefix => $uri) {
            $rdf['prefix'][] = $prefix . ': ' . $uri;
        }
        if (!$rdf['prefix']) {
            $rdf = array();
        }
        $variables['rdf_namespaces'] = drupal_attributes($rdf);
    }
    // BODY element attributes.
    $variables['body_attributes_array'] = array('class' => &$variables['classes_array']);
    $variables['body_attributes_array'] += $variables['attributes_array'];
    // Navbar position.
    switch (bootstrap_setting('navbar_position')) {
        case 'fixed-top':
            $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-top';
            break;
        case 'fixed-bottom':
            $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-bottom';
            break;
        case 'static-top':
            $variables['body_attributes_array']['class'][] = 'navbar-is-static-top';
            break;
    }
}
开发者ID:PixelGarage,项目名称:hso2,代码行数:43,代码来源:html.vars.php


示例7: bootstrap_filter_tips_more_info

/**
 * Returns HTML for a link to the more extensive filter tips.
 *
 * @return string
 *   The constructed HTML.
 *
 * @see theme_filter_tips_more_info()
 *
 * @ingroup theme_functions
 */
function bootstrap_filter_tips_more_info()
{
    $attributes = array('target' => '_blank', 'title' => t('Opens in new window'));
    if (bootstrap_setting('tooltip_enabled')) {
        $attributes['data-toggle'] = 'tooltip';
    }
    return l(_bootstrap_icon('question-sign') . t('More information about text formats'), 'filter/tips', array('html' => TRUE, 'attributes' => $attributes));
}
开发者ID:brkrishna,项目名称:freelance,代码行数:18,代码来源:filter-tips-more-info.func.php


示例8: bootstrap_breadcrumb

/**
 * Overrides theme_breadcrumb().
 *
 * Print breadcrumbs as an ordered list.
 */
function bootstrap_breadcrumb($variables)
{
    $output = '';
    $breadcrumb = $variables['breadcrumb'];
    // Determine if we are to display the breadcrumb.
    $bootstrap_breadcrumb = bootstrap_setting('breadcrumb');
    if (($bootstrap_breadcrumb == 1 || $bootstrap_breadcrumb == 2 && arg(0) == 'admin') && !empty($breadcrumb)) {
        $output = theme('item_list', array('attributes' => array('class' => array('breadcrumb')), 'items' => $breadcrumb, 'type' => 'ol'));
    }
    return $output;
}
开发者ID:lcube45,项目名称:hyx,代码行数:16,代码来源:breadcrumb.func.php


示例9: bootstrap_preprocess_image

/**
 * Pre-processes variables for the "image" theme hook.
 *
 * See theme function for list of available variables.
 *
 * @see theme_image()
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_image(&$variables)
{
    // Add image shape, if necessary.
    if ($shape = bootstrap_setting('image_shape')) {
        _bootstrap_add_class($shape, $variables);
    }
    // Add responsiveness, if necessary.
    if (bootstrap_setting('image_responsive')) {
        _bootstrap_add_class('img-responsive', $variables);
    }
}
开发者ID:brkrishna,项目名称:freelance,代码行数:20,代码来源:image.vars.php


示例10: walk_preprocess_page

/**
 * Pre-processes variables for the "page" theme hook.
 *
 * See template for list of available variables.
 *
 * @see page.tpl.php
 *
 * @ingroup theme_preprocess
 */
function walk_preprocess_page(&$vars)
{
    // Add information about the number of sidebars.
    if (!empty($vars['page']['sidebar_first']) && !empty($vars['page']['sidebar_second'])) {
        $vars['content_column_class'] = ' class="col-sm-6"';
    } elseif (!empty($vars['page']['sidebar_first']) || !empty($vars['page']['sidebar_second'])) {
        $vars['content_column_class'] = ' class="col-sm-9"';
    } else {
        $vars['content_column_class'] = ' class="col-sm-12"';
    }
    if (bootstrap_setting('fluid_container') == 1) {
        $vars['container_class'] = 'container-fluid';
    } else {
        $vars['container_class'] = 'container';
    }
    // Primary nav.
    $vars['primary_nav'] = FALSE;
    if ($vars['main_menu']) {
        // Build links.
        $vars['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
        // Provide default theme wrapper function.
        $vars['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
    }
    // Secondary nav.
    $vars['secondary_nav'] = FALSE;
    if ($vars['secondary_menu']) {
        // Build links.
        $vars['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
        // Provide default theme wrapper function.
        $vars['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
    }
    $vars['navbar_classes_array'] = array('navbar');
    if (bootstrap_setting('navbar_position') !== '') {
        $vars['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position');
    } elseif (bootstrap_setting('fluid_container') == 1) {
        $vars['navbar_classes_array'][] = 'container-fluid';
    } else {
        $vars['navbar_classes_array'][] = 'container';
    }
    if (bootstrap_setting('navbar_inverse')) {
        $vars['navbar_classes_array'][] = 'navbar-inverse';
    } else {
        $vars['navbar_classes_array'][] = 'navbar-default';
    }
    if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'walk') {
        drupal_set_title('Hosting a Walk');
    }
    if (isset($vars['node']) && $vars['node']->nid == 12) {
        //dpm($vars);
        hide($vars['page']['content']['system_main']['nodes']);
    }
}
开发者ID:benjohnstone,项目名称:wwyd,代码行数:61,代码来源:page.vars.php


示例11: bootstrap_preprocess_html

/**
 * Pre-processes variables for the "html" theme hook.
 *
 * See template for list of available variables.
 *
 * @see html.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_html(&$variables)
{
    switch (bootstrap_setting('navbar_position')) {
        case 'fixed-top':
            $variables['attributes']['class'][] = 'navbar-is-fixed-top';
            break;
        case 'fixed-bottom':
            $variables['attributes']['class'][] = 'navbar-is-fixed-bottom';
            break;
        case 'static-top':
            $variables['attributes']['class'][] = 'navbar-is-static-top';
            break;
    }
}
开发者ID:sathishRio,项目名称:themes,代码行数:23,代码来源:html.vars.php


示例12: bootstrap_breadcrumb

/**
 * Returns HTML for a breadcrumb trail.
 *
 * @param array $variables
 *   An associative array containing:
 *   - breadcrumb: An array containing the breadcrumb links.
 *
 * @return string
 *   The constructed HTML.
 *
 * @see theme_breadcrumb()
 *
 * @ingroup theme_functions
 */
function bootstrap_breadcrumb($variables)
{
    // Use the Path Breadcrumbs theme function if it should be used instead.
    if (_bootstrap_use_path_breadcrumbs()) {
        return path_breadcrumbs_breadcrumb($variables);
    }
    $output = '';
    $breadcrumb = $variables['breadcrumb'];
    // Determine if we are to display the breadcrumb.
    $bootstrap_breadcrumb = bootstrap_setting('breadcrumb');
    if (($bootstrap_breadcrumb == 1 || $bootstrap_breadcrumb == 2 && arg(0) == 'admin') && !empty($breadcrumb)) {
        $output = theme('item_list', array('attributes' => array('class' => array('breadcrumb')), 'items' => $breadcrumb, 'type' => 'ol'));
    }
    return $output;
}
开发者ID:brkrishna,项目名称:freelance,代码行数:29,代码来源:breadcrumb.func.php


示例13: bootstrap_preprocess_breadcrumb

/**
 * Implements hook_preprocess_breadcrumb().
 */
function bootstrap_preprocess_breadcrumb(&$variables)
{
    $breadcrumb =& $variables['breadcrumb'];
    // Optionally get rid of the homepage link.
    $show_breadcrumb_home = bootstrap_setting('breadcrumb_home');
    if (!$show_breadcrumb_home) {
        array_shift($breadcrumb);
    }
    if (bootstrap_setting('breadcrumb_title') && !empty($breadcrumb)) {
        $item = menu_get_item();
        $page_title = !empty($item['tab_parent']) ? check_plain($item['title']) : drupal_get_title();
        if (!empty($page_title)) {
            $breadcrumb[] = array('data' => $page_title, 'class' => array('active'));
        }
    }
}
开发者ID:lcube45,项目名称:hyx,代码行数:19,代码来源:breadcrumb.vars.php


示例14: bootstrap_preprocess_breadcrumb

/**
 * Pre-processes variables for the "breadcrumb" theme hook.
 *
 * See theme function for list of available variables.
 *
 * @see bootstrap_breadcrumb()
 * @see theme_breadcrumb()
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_breadcrumb(&$variables)
{
    $breadcrumb =& $variables['breadcrumb'];
    // Optionally get rid of the homepage link.
    $show_breadcrumb_home = bootstrap_setting('breadcrumb_home');
    if (!$show_breadcrumb_home) {
        array_shift($breadcrumb);
    }
    if (bootstrap_setting('breadcrumb_title') && !empty($breadcrumb)) {
        $request = \Drupal::request();
        $route_match = \Drupal::routeMatch();
        $page_title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
        if (!empty($page_title)) {
            $breadcrumb[] = array('text' => $page_title, 'attributes' => new Attribute(array('class' => array('active'))));
        }
    }
}
开发者ID:sathishRio,项目名称:themes,代码行数:27,代码来源:breadcrumb.vars.php


示例15: angole_preprocess_page

/**
 * Pre-processes variables for the "page" theme hook.
 *
 * See template for list of available variables.
 *
 * @see page.tpl.php
 *
 * @ingroup theme_preprocess
 */
function angole_preprocess_page(&$variables)
{
    // Add information about the number of sidebars.
    if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_class'] = ' class="col-lg-6"';
    } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_class'] = ' class="col-lg-9"';
    } else {
        $variables['content_column_class'] = ' class="col-lg-12"';
    }
    if (bootstrap_setting('fluid_container') == 1) {
        $variables['container_class'] = 'container-fluid';
    } else {
        $variables['container_class'] = 'container';
    }
    // Primary nav.
    $variables['primary_nav'] = FALSE;
    if ($variables['main_menu']) {
        // Build links.
        $variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
        // Provide default theme wrapper function.
        $variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
    }
    // Secondary nav.
    $variables['secondary_nav'] = FALSE;
    if ($variables['secondary_menu']) {
        // Build links.
        $variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
        // Provide default theme wrapper function.
        $variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
    }
    $variables['navbar_classes_array'] = array('navbar');
    if (bootstrap_setting('navbar_position') !== '') {
        $variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position');
    } elseif (bootstrap_setting('fluid_container') == 1) {
        $variables['navbar_classes_array'][] = 'container-fluid';
    } else {
        $variables['navbar_classes_array'][] = 'container';
    }
    if (bootstrap_setting('navbar_inverse')) {
        $variables['navbar_classes_array'][] = 'navbar-inverse';
    } else {
        $variables['navbar_classes_array'][] = 'navbar-default';
    }
}
开发者ID:scdantilles,项目名称:angole-theme,代码行数:54,代码来源:page.vars.php


示例16: bootstrap_preprocess_button

/**
 * Implements hook_preprocess_button().
 */
function bootstrap_preprocess_button(&$vars)
{
    $element =& $vars['element'];
    // Set the element's attributes.
    element_set_attributes($element, array('id', 'name', 'value', 'type'));
    // Add the base Bootstrap button class.
    $element['#attributes']['class'][] = 'btn';
    // Add button size, if necessary.
    if ($size = bootstrap_setting('button_size')) {
        $element['#attributes']['class'][] = $size;
    }
    // Colorize button.
    _bootstrap_colorize_button($element);
    // Add in the button type class.
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    // Ensure that all classes are unique, no need for duplicates.
    $element['#attributes']['class'] = array_unique($element['#attributes']['class']);
}
开发者ID:OlyaRybak,项目名称:vuxenforvaltningens_informationsportal,代码行数:21,代码来源:button.vars.php


示例17: bootstrap_preprocess_page

/**
 * Pre-processes variables for the "page" theme hook.
 *
 * See template for list of available variables.
 *
 * @see page.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_page(&$variables)
{
    // Add information about the number of sidebars.
    $variables['content_column_attributes'] = new Attribute();
    $variables['content_column_attributes']['class'] = array();
    if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_attributes']['class'][] = 'col-sm-6';
    } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_attributes']['class'][] = 'col-sm-9';
    } else {
        $variables['content_column_attributes']['class'][] = 'col-sm-12';
    }
    $variables['navbar_attributes'] = new Attribute();
    $variables['navbar_attributes']['class'] = array('navbar');
    if (bootstrap_setting('navbar_position') !== '') {
        $variables['navbar_attributes']['class'][] = 'navbar-' . bootstrap_setting('navbar_position');
    } else {
        $variables['navbar_attributes']['class'][] = 'container';
    }
    if (bootstrap_setting('navbar_inverse')) {
        $variables['navbar_attributes']['class'][] = 'navbar-inverse';
    } else {
        $variables['navbar_attributes']['class'][] = 'navbar-default';
    }
    // Primary nav.
    $menu_tree = \Drupal::menuTree();
    // Render the top-level administration menu links.
    $parameters = new MenuTreeParameters();
    $tree = $menu_tree->load('main', $parameters);
    $manipulators = array(array('callable' => 'menu.default_tree_manipulators:checkAccess'), array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'));
    $tree = $menu_tree->transform($tree, $manipulators);
    $variables['primary_nav'] = $menu_tree->build($tree);
    $variables['primary_nav']['#attributes']['class'][] = 'navbar-nav';
    // Primary nav.
    $menu_tree = \Drupal::menuTree();
    // Render the top-level administration menu links.
    $parameters = new MenuTreeParameters();
    $tree = $menu_tree->load('account', $parameters);
    $manipulators = array(array('callable' => 'menu.default_tree_manipulators:checkAccess'), array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'));
    $tree = $menu_tree->transform($tree, $manipulators);
    $variables['secondary_nav'] = $menu_tree->build($tree);
    $variables['secondary_nav']['#attributes']['class'][] = 'navbar-nav';
    $variables['secondary_nav']['#attributes']['class'][] = 'secondary';
}
开发者ID:sathishRio,项目名称:themes,代码行数:53,代码来源:page.vars.php


示例18: bootstrap_preprocess_button

/**
 * Pre-processes variables for the "button" theme hook.
 *
 * See theme function for list of available variables.
 *
 * @see bootstrap_button()
 * @see theme_button()
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_button(&$vars)
{
    $element =& $vars['element'];
    // Drupal buttons should be of type 'submit'.
    // @see https://www.drupal.org/node/2540452
    $element['#attributes']['type'] = 'submit';
    // Set the element's other attributes.
    element_set_attributes($element, array('id', 'name', 'value'));
    // Add the base Bootstrap button class.
    $element['#attributes']['class'][] = 'btn';
    // Add button size, if necessary.
    if ($size = bootstrap_setting('button_size')) {
        $element['#attributes']['class'][] = $size;
    }
    // Colorize button.
    _bootstrap_colorize_button($element);
    // Add in the button type class.
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    // Ensure that all classes are unique, no need for duplicates.
    $element['#attributes']['class'] = array_unique($element['#attributes']['class']);
}
开发者ID:drupdateio,项目名称:gvj,代码行数:31,代码来源:button.vars.php


示例19: bootstrap_file_upload_help

/**
 * Returns HTML for help text based on file upload validators.
 *
 * @param array $variables
 *   An associative array containing:
 *   - description: The normal description for this field, specified by the
 *     user.
 *   - upload_validators: An array of upload validators as used in
 *     $element['#upload_validators'].
 *
 * @return string
 *   The constructed HTML.
 *
 * @see theme_file_upload_help()
 *
 * @ingroup theme_functions
 */
function bootstrap_file_upload_help($variables)
{
    // If popover's are disabled, just theme this normally.
    if (!bootstrap_setting('popover_enabled')) {
        return theme_file_upload_help($variables);
    }
    $build = array();
    if (!empty($variables['description'])) {
        $build['description'] = array('#markup' => $variables['description'] . '<br>');
    }
    $descriptions = array();
    $upload_validators = $variables['upload_validators'];
    if (isset($upload_validators['file_validate_size'])) {
        $descriptions[] = t('Files must be less than !size.', array('!size' => '<strong>' . format_size($upload_validators['file_validate_size'][0]) . '</strong>'));
    }
    if (isset($upload_validators['file_validate_extensions'])) {
        $descriptions[] = t('Allowed file types: !extensions.', array('!extensions' => '<strong>' . check_plain($upload_validators['file_validate_extensions'][0]) . '</strong>'));
    }
    if (isset($upload_validators['file_validate_image_resolution'])) {
        $max = $upload_validators['file_validate_image_resolution'][0];
        $min = $upload_validators['file_validate_image_resolution'][1];
        if ($min && $max && $min == $max) {
            $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
        } elseif ($min && $max) {
            $descriptions[] = t('Images must be between !min and !max pixels.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
        } elseif ($min) {
            $descriptions[] = t('Images must be larger than !min pixels.', array('!min' => '<strong>' . $min . '</strong>'));
        } elseif ($max) {
            $descriptions[] = t('Images must be smaller than !max pixels.', array('!max' => '<strong>' . $max . '</strong>'));
        }
    }
    if ($descriptions) {
        $id = drupal_html_id('upload-instructions');
        $build['instructions'] = array('#theme' => 'link__file_upload_requirements', '#text' => _bootstrap_icon('question-sign') . ' ' . t('More information'), '#path' => '#', '#options' => array('attributes' => array('data-toggle' => 'popover', 'data-target' => "#{$id}", 'data-html' => TRUE, 'data-placement' => 'bottom', 'data-title' => t('File requirements')), 'html' => TRUE, 'external' => TRUE));
        $build['requirements'] = array('#theme_wrappers' => array('container__file_upload_requirements'), '#attributes' => array('id' => $id, 'class' => array('element-invisible', 'help-block')));
        $build['requirements']['validators'] = array('#theme' => 'item_list__file_upload_requirements', '#items' => $descriptions);
    }
    return drupal_render($build);
}
开发者ID:sodacrackers,项目名称:washyacht,代码行数:56,代码来源:file-upload-help.func.php


示例20: _bootstrap_table_add_classes

/**
 * Helper function for adding the necessary classes to a table.
 *
 * @param array $classes
 *   The array of classes, passed by reference.
 * @param array $variables
 *   The variables of the theme hook, passed by reference.
 */
function _bootstrap_table_add_classes(&$classes, &$variables)
{
    $context = $variables['context'];
    // Generic table class for all tables.
    $classes[] = 'table';
    // Bordered table.
    if (!empty($context['bordered']) || bootstrap_setting('table_bordered')) {
        $classes[] = 'table-bordered';
    }
    // Condensed table.
    if (!empty($context['condensed']) || bootstrap_setting('table_condensed')) {
        $classes[] = 'table-condensed';
    }
    // Hover rows.
    if (!empty($context['hover']) || bootstrap_setting('table_hover')) {
        $classes[] = 'table-hover';
    }
    // Striped rows.
    if (!empty($context['striped']) || bootstrap_setting('table_striped')) {
        $classes[] = 'table-striped';
    }
    $variables['responsive'] = !empty($context['responsive']) ? $context['responsive'] : bootstrap_setting('table_responsive');
}
开发者ID:sathishRio,项目名称:themes,代码行数:31,代码来源:table.vars.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP border函数代码示例发布时间:2022-05-24
下一篇:
PHP bootstrap_input函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap