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


PHP drupal_clean_css_identifier函数代码示例

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


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

示例1: viewMultiple

 /**
  * {@inheritdoc}
  */
 public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL)
 {
     /** @var \Drupal\tour\TourInterface[] $entities */
     $build = array();
     foreach ($entities as $entity_id => $entity) {
         $tips = $entity->getTips();
         $count = count($tips);
         $list_items = array();
         foreach ($tips as $index => $tip) {
             if ($output = $tip->getOutput()) {
                 $attributes = array('class' => array('tip-module-' . drupal_clean_css_identifier($entity->get('module')), 'tip-type-' . drupal_clean_css_identifier($tip->get('plugin')), 'tip-' . drupal_clean_css_identifier($tip->get('id'))));
                 $list_items[] = array('output' => $output, 'counter' => array('#type' => 'container', '#attributes' => array('class' => array('tour-progress')), '#children' => t('!tour_item of !total', array('!tour_item' => $index + 1, '!total' => $count))), '#wrapper_attributes' => $tip->getAttributes() + $attributes);
             }
         }
         // If there is at least one tour item, build the tour.
         if ($list_items) {
             end($list_items);
             $key = key($list_items);
             $list_items[$key]['#wrapper_attributes']['data-text'] = t('End tour');
             $build[$entity_id] = array('#theme' => 'item_list', '#items' => $list_items, '#list_type' => 'ol', '#attributes' => array('id' => 'tour', 'class' => array('hidden')), '#cache' => ['tags' => $entity->getCacheTags()]);
         }
     }
     // If at least one tour was built, attach the tour library.
     if ($build) {
         $build['#attached']['library'][] = 'tour/tour';
     }
     return $build;
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:31,代码来源:TourViewBuilder.php

示例2: masthead_preprocess_html

function masthead_preprocess_html(&$vars)
{
    $path = drupal_get_path_alias($_GET['q']);
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $vars['classes_array'][] = drupal_clean_css_identifier($alias);
    }
}
开发者ID:etype-services,项目名称:delphos,代码行数:8,代码来源:template.php

示例3: danbury_preprocess_html

function danbury_preprocess_html(&$variables)
{
    $path = drupal_get_path_alias($_GET['q']);
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $variables['classes_array'][] = 'path-' . drupal_clean_css_identifier($alias);
    }
}
开发者ID:CCI-Studios,项目名称:Danbury-Homes,代码行数:8,代码来源:template.php

示例4: da_vinci_preprocess_user_profile

/**
 * Implement da_vinci_preprocess_user_profile().
 */
function da_vinci_preprocess_user_profile(&$vars)
{
    if (!empty($vars['elements']['#view_mode'])) {
        // Add suggestion for user entity view modes:
        $vars['theme_hook_suggestions'][] = 'user_profile__' . $vars['elements']['#view_mode'];
        // Add view-mode class:
        $vars['classes_array'][] = 'user-' . drupal_clean_css_identifier($vars['elements']['#view_mode']);
    }
}
开发者ID:nikasha,项目名称:refugiolahiguera,代码行数:12,代码来源:template.preprocess.user-profile.php

示例5: apigee_bootstrap_preprocess_html

/**
 * Preprocessor for theme('html')
 *
 * @see html.tpl.php
 */
function apigee_bootstrap_preprocess_html(&$vars)
{
    // Add some additional body classes based on path
    $path = drupal_get_path_alias($_GET['q']);
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $vars['classes_array'][] = drupal_clean_css_identifier($alias);
    }
}
开发者ID:freighthouse,项目名称:code,代码行数:14,代码来源:template.php

示例6: templateName_preprocess_html

function templateName_preprocess_html(&$variables)
{
    $node = node_load(arg(1));
    $results = taxonomy_node_get_terms($node);
    if (is_array($results)) {
        foreach ($results as $item) {
            $variables['classes_array'][] = "taxonomy-" . strtolower(drupal_clean_css_identifier($item->name));
        }
    }
}
开发者ID:Virprince,项目名称:drupal7,代码行数:10,代码来源:template-override-utile.php

示例7: getId

 /**
  * {@inheritdoc}
  */
 public function getId()
 {
     if (!isset($this->id)) {
         $css_map_name = drupal_clean_css_identifier($this->getMachineName());
         // Use uniqid to ensure we've really an unique id - otherwise there will
         // occur issues with caching.
         $this->id = drupal_html_id('openlayers-map-' . $css_map_name . '-' . uniqid('', TRUE));
     }
     return $this->id;
 }
开发者ID:josemrc,项目名称:ae2web,代码行数:13,代码来源:Map.php

示例8: jbase_preprocess_html

/**
 * Override or insert variables into the html template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function jbase_preprocess_html(&$vars)
{
    // give <body> tag a unique class depending on PATHs
    $path_alias = strtolower(drupal_clean_css_identifier(drupal_get_path_alias($_GET['q'])));
    if ($path_alias == 'node') {
        $vars['classes_array'][] = '';
    } else {
        $vars['classes_array'][] = 'path-' . $path_alias;
    }
    // Add to the array of body classes
    // layout classes
    $vars['classes_array'][] = 'layout-' . (!empty($vars['page']['sidebar_first']) ? 'first-main' : 'main') . (!empty($vars['page']['sidebar_second']) ? '-second' : '');
    // headers classes
    if (!empty($vars['page']['header_first']) || !empty($vars['page']['header_second']) || !empty($vars['page']['header_third'])) {
        $header_regions = 'header';
        $header_regions .= !empty($vars['page']['header_first']) ? '-first' : '';
        $header_regions .= !empty($vars['page']['header_second']) ? '-second' : '';
        $header_regions .= !empty($vars['page']['header_third']) ? '-third' : '';
        $vars['classes_array'][] = $header_regions;
    }
    // preface classes
    if (!empty($vars['page']['preface_first']) || !empty($vars['page']['preface_second']) || !empty($vars['page']['preface_third'])) {
        $preface_regions = 'preface';
        $preface_regions .= !empty($vars['page']['preface_first']) ? '-first' : '';
        $preface_regions .= !empty($vars['page']['preface_second']) ? '-second' : '';
        $preface_regions .= !empty($vars['page']['preface_third']) ? '-third' : '';
        $vars['classes_array'][] = $preface_regions;
    }
    // postscripts classes
    if (!empty($vars['page']['postscript_first']) || !empty($vars['page']['postscript_second']) || !empty($vars['page']['postscript_third'])) {
        $postscript_regions = 'postscript';
        $postscript_regions .= !empty($vars['page']['postscript_first']) ? '-first' : '';
        $postscript_regions .= !empty($vars['page']['postscript_second']) ? '-second' : '';
        $postscript_regions .= !empty($vars['page']['postscript_third']) ? '-third' : '';
        $vars['classes_array'][] = $postscript_regions;
    }
    // footers classes
    if (!empty($vars['page']['footer_first']) || !empty($vars['page']['footer_second']) || !empty($vars['page']['footer_third'])) {
        $footer_regions = 'footers';
        $footer_regions .= !empty($vars['page']['footer_first']) ? '-first' : '';
        $footer_regions .= !empty($vars['page']['footer_second']) ? '-second' : '';
        $footer_regions .= !empty($vars['page']['footer_third']) ? '-third' : '';
        $vars['classes_array'][] = $footer_regions;
    }
    // Panels classes
    $vars['classes_array'][] = module_exists('panels') && panels_get_current_page_display() ? 'panels' : '';
    if (module_exists('panels') && panels_get_current_page_display()) {
        $panels_display = panels_get_current_page_display();
        $vars['classes_array'][] = 'panels-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $panels_display->layout));
    }
    $vars['classes_array'] = array_filter($vars['classes_array']);
    // IE stylesheets
    drupal_add_css(path_to_theme() . '/css/ie7-fixes.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(path_to_theme() . '/css/ie8-fixes.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
}
开发者ID:jaywolf,项目名称:jBase,代码行数:61,代码来源:template.php

示例9: zeven_preprocess_html

function zeven_preprocess_html(&$vars)
{
    # add role-class in body tag
    if ($vars['user']) {
        foreach ($vars['user']->roles as $key => $role) {
            $role_class = 'role-' . drupal_clean_css_identifier($role);
            $role_class = strtolower($role_class);
            $vars['classes_array'][] = $role_class;
        }
    }
}
开发者ID:bartcornelis,项目名称:comfortenergy,代码行数:11,代码来源:template.php

示例10: getCustomClass

 /**
  * Return the token-replaced row or column classes for the specified result.
  *
  * @param int $result_index
  *   The delta of the result item to get custom classes for.
  * @param string $type
  *   The type of custom grid class to return, either "row" or "col".
  *
  * @return string
  *   A space-delimited string of classes.
  */
 public function getCustomClass($result_index, $type)
 {
     $class = $this->options[$type . '_class_custom'];
     if ($this->usesFields() && $this->view->field) {
         $class = strip_tags($this->tokenizeValue($class, $result_index));
     }
     $classes = explode(' ', $class);
     foreach ($classes as &$class) {
         $class = drupal_clean_css_identifier($class);
     }
     return implode(' ', $classes);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:23,代码来源:Grid.php

示例11: masthead_preprocess_html

/**
 * Add Page Body Class
 * Add Custom Title to Home Page
 * @param $vars
 */
function masthead_preprocess_html(&$vars)
{
    $path = drupal_get_path_alias($_GET['q']);
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $vars['classes_array'][] = drupal_clean_css_identifier($alias);
    }
    if (drupal_is_front_page() == TRUE) {
        $site_name = variable_get('site_name', 'Drupal');
        $vars['head_title'] = 'Home | ' . $site_name;
    }
}
开发者ID:etype-services,项目名称:moser,代码行数:17,代码来源:template.php

示例12: townsquare_bootstrap_preprocess_page

/**
 * Implements theme_preprocess_page().
 */
function townsquare_bootstrap_preprocess_page(&$vars)
{
    global $user;
    $vars['primary_local_tasks'] = menu_primary_local_tasks();
    $vars['secondary_local_tasks'] = menu_secondary_local_tasks();
    // The following menu stuff is lame
    foreach ($vars['main_menu'] as $item => $options) {
        $vars['main_menu'][$item]['html'] = TRUE;
        $vars['main_menu'][$item]['attributes']['id'] = 'menu-link-' . drupal_clean_css_identifier($options['href']);
    }
    $admin_menu = menu_tree_all_data('management');
    $children = array_pop($admin_menu);
    if ($children) {
        foreach ($children['below'] as $key => $value) {
            $children['below'][$key]['below'] = array();
        }
        $vars['admin_menu'] = menu_tree_output($children['below']);
    }
    // Add user picture if logged in
    if ($user->uid) {
        $vars['user_name'] = check_plain($user->name);
        if (!empty($user->picture)) {
            if (is_numeric($user->picture)) {
                $user->picture = file_load($user->picture);
            }
            if (!empty($user->picture->uri)) {
                $filepath = $user->picture->uri;
            }
        } elseif (variable_get('user_picture_default', '')) {
            $filepath = variable_get('user_picture_default', '');
        }
        if (isset($filepath)) {
            $alt = t("@user's picture", array('@user' => format_username($user)));
            if (module_exists('image') && file_valid_uri($filepath) && ($style = variable_get('user_picture_style', ''))) {
                $vars['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
            } else {
                $vars['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
            }
        } else {
            $vars['user_picture'] = '<i class="icon-user"></i>';
        }
    } else {
        unset($vars['secondary_menu']);
        $vars['login'] = drupal_get_form('user_login_block');
    }
    // Add Bootstrap
    $path = libraries_get_path('bootstrap');
    drupal_add_css($path . '/css/bootstrap.css');
    drupal_add_css($path . '/css/bootstrap-responsive.css');
    drupal_add_js($path . '/js/bootstrap.js');
    $path = libraries_get_path('font-awesome');
    drupal_add_css($path . '/css/font-awesome.css');
}
开发者ID:nningego,项目名称:townsquare,代码行数:56,代码来源:template.php

示例13: cni_preprocess_html

/**
 * @param $vars
 */
function cni_preprocess_html(&$vars)
{
    $base_path = base_path();
    $conf_path = conf_path();
    $site_css = $base_path . $conf_path . '/cni-site.css';
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . $site_css)) {
        drupal_add_css($site_css, array('type' => 'file', 'media' => 'all', 'preprocess' => false, 'every_page' => true, 'weight' => 999, 'group' => CSS_THEME));
    }
    /* Add Page Body Class */
    $path = drupal_get_path_alias($_GET['q']);
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $vars['classes_array'][] = drupal_clean_css_identifier($alias);
    }
}
开发者ID:etype-services,项目名称:cni-theme,代码行数:18,代码来源:template.php

示例14: standardcommunitychurch_preprocess_html

function standardcommunitychurch_preprocess_html(&$vars)
{
    $path = drupal_get_path_alias();
    $aliases = explode('/', $path);
    foreach ($aliases as $alias) {
        $vars['classes_array'][] = drupal_clean_css_identifier('alias-' . $alias);
    }
    $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1'));
    drupal_add_html_head($viewport, 'viewport');
    if (drupal_is_front_page()) {
        drupal_add_js(path_to_theme() . '/js/home.js', array('group' => JS_THEME, 'type' => 'file', 'scope' => 'footer'));
        drupal_add_css(path_to_theme() . '/css/vendor/flexslider.css', array('group' => CSS_SYSTEM, 'type' => 'file'));
        drupal_add_js(path_to_theme() . '/js/vendor/jquery.flexslider-min.js', array('group' => JS_LIBRARY, 'type' => 'file', 'scope' => 'footer'));
    }
}
开发者ID:msharps,项目名称:standardcommunitychurch,代码行数:15,代码来源:template.php

示例15: drupalmel_theme_preprocess_semantic_panels_pane

/**
 * Implements hook_preprocess_panels_pane().
 */
function drupalmel_theme_preprocess_semantic_panels_pane(&$variables)
{
    switch ($variables['pane']->subtype) {
        // Add <span> to site name string.
        case 'blockify-blockify-site-name':
            preg_match_all('/([A-Z][a-z]+|[0-9]+)/', variable_get('site_name', NULL), $parts);
            $name = '';
            if (isset($parts[1])) {
                foreach ($parts[1] as $delta => $part) {
                    $id = drupal_clean_css_identifier($part);
                    $name .= '<span class="part-' . $delta . ' part-' . $id . '">' . filter_xss($part) . '</span>';
                }
            }
            $variables['content_html'] = str_replace('<span>' . variable_get('site_name', NULL) . '</span>', $name, $variables['content_html']);
            break;
    }
}
开发者ID:Decipher,项目名称:drupalmel,代码行数:20,代码来源:template.php


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