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


PHP bootstrap_setting函数代码示例

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


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


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