/**
 * Implements theme_preprocess_node().
 */
function basetpl_preprocess_node(&$variables)
{
    /* classes */
    $classes = array();
    $classes[] = drupal_html_class('node-' . $variables['node']->type);
    $classes[] = drupal_html_class($variables['view_mode']);
    if (isset($variables['title_suffix']['contextual_links'])) {
        $classes[] = 'contextual-links-region';
    }
    $variables['title_attributes_array']['class'] = 'node-title';
    $variables['classes_array'] = $classes;
    /* theme hook suggestions */
    $variables['theme_hook_suggestions'][] = 'node__' . $variables['view_mode'];
    $variables['theme_hook_suggestions'][] = 'node__' . $variables['node']->type . '__' . $variables['view_mode'];
    /* node footer */
    $variables['footer'] = TRUE;
    /* node links
    	if(!empty($variables['content']['links']['node']['#links']) || !empty($variables['content']['links']['comment']['#links'])) {
    		$variables['content']['links']['#prefix'] = '<div class="inline-menu">';
    		$variables['content']['links']['#suffix'] = '</div>';
    		$variables['content']['links']['#attributes']['class'] = array('menu','node-links');
    		if(isset($variables['content']['links']['node']['#links']['node-readmore'])) {
    			$variables['content']['links']['node']['#links']['node-readmore']['attributes']['class'] = array('read-more');
    		}
    		if(isset($variables['content']['links']['comment']['#links']['comment-add'])) {
    			$variables['content']['links']['comment']['#links']['comment-add']['attributes']['class'] = array('add-comment');
    		}
    	}
    	*/
}
Exemple #2
0
/**
 * Implements template_preprocess_node().
 */
function glisseo_preprocess_node(&$variables)
{
    // New classes. More clear then defaults.
    $variables['clean_classes_array'] = array();
    $variables['clean_classes_array'][] = drupal_html_class($variables['type']);
    $variables['clean_classes_array'][] = drupal_html_class($variables['view_mode']);
    // We add 'teaser' class, if content is teaser and don't have 'teaser' vew mode.
    if ($variables['teaser'] && !in_array('teaser', $variables['clean_classes_array'])) {
        $variables['clean_classes_array'][] = drupal_html_class('teaser');
    }
    // If content is sticky, we add special class.
    if ($variables['sticky']) {
        $variables['clean_classes_array'][] = drupal_html_class('sticky');
    }
    // We add that class only when contextual links enabled.
    if (module_exists('contextual')) {
        $variables['clean_classes_array'][] = drupal_html_class('contextual-links-region');
    }
    // Generate clean classes variable.
    $variables['clean_classes'] = implode(' ', $variables['clean_classes_array']);
    // Work with Node object.
    $node = $variables['node'];
    // Save field values to variables.
    foreach ($node as $label => $data) {
        // Is label is field.
        if (preg_match("/field_(.*)?/i", $label, $matches)) {
            $variables[$label] = field_get_items('node', $node, $label);
        }
    }
}
Exemple #3
0
/**
 * Returns HTML for a set of filter tips.
 *
 * @param array $variables
 *   An associative array containing:
 *   - tips: An array containing descriptions and a CSS ID in the form of
 *     'module-name/filter-id' (only used when $long is TRUE) for each
 *     filter in one or more text formats. Example:
 *     @code
 *       array(
 *         'Full HTML' => array(
 *           0 => array(
 *             'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
 *             'id' => 'filter/2',
 *           ),
 *         ),
 *       );
 *     @endcode
 *   - long: (optional) Whether the passed-in filter tips contain extended
 *     explanations, i.e. intended to be output on the path 'filter/tips'
 *     (TRUE), or are in a short format, i.e. suitable to be displayed below a
 *     form element. Defaults to FALSE.
 *
 * @return string
 *   The constructed HTML.
 *
 * @see theme_filter_tips()
 * @see _filter_tips()
 *
 * @ingroup theme_functions
 */
function bootstrap_filter_tips($variables)
{
    $format_id = arg(2);
    $current_path = current_path();
    $tips = _filter_tips(-1, TRUE);
    // Create a place holder for the tabs.
    $build['tabs'] = array('#theme' => 'item_list', '#items' => array(), '#attributes' => array('class' => array('nav', 'nav-tabs'), 'role' => 'tablist'));
    // Create a placeholder for the panes.
    $build['panes'] = array('#theme_wrappers' => array('container'), '#attributes' => array('class' => array('tab-content')));
    foreach ($tips as $name => $list) {
        $machine_name = str_replace('-', '_', drupal_html_class($name));
        $tab = array('data' => array('#type' => 'link', '#title' => check_plain($name), '#href' => $current_path, '#attributes' => array('role' => 'tab', 'data-toggle' => 'tab'), '#options' => array('fragment' => $machine_name)));
        if (!$format_id || $format_id === $machine_name) {
            $tab['class'][] = 'active';
            $format_id = $machine_name;
        }
        $build['tabs']['#items'][] = $tab;
        // Extract the actual tip.
        $tiplist = array();
        foreach ($list as $tip) {
            $tiplist[] = $tip['tip'];
        }
        // Construct the pane.
        $pane = array('#theme_wrappers' => array('container'), '#attributes' => array('class' => array('tab-pane', 'fade'), 'id' => $machine_name), 'list' => array('#theme' => 'item_list', '#items' => $tiplist));
        if ($format_id === $machine_name) {
            $pane['#attributes']['class'][] = 'active';
            $pane['#attributes']['class'][] = 'in';
            $format_id = $machine_name;
        }
        $build['panes'][] = $pane;
    }
    return drupal_render($build);
}
function jollyness_preprocess_html(&$vars)
{
    //Process portfolio color
    if ($portfolio_category = taxonomy_vocabulary_machine_name_load('portfolio_category')) {
        $terms = taxonomy_get_tree($portfolio_category->vid);
        $less = new lessc();
        $css = '';
        $color = '';
        $class = '';
        foreach ($terms as $t) {
            $term = taxonomy_term_load($t->tid);
            $class = drupal_html_class($t->name);
            if (!empty($term->field_color)) {
                foreach ($term->field_color as $v) {
                    $color = $v[0]['value'];
                    break;
                }
            }
            if ($color) {
                $css .= ".dexp-masonry-filter,.dexp-portfolio-filter{.{$class} span:before{background-color: {$color} !important;}}";
                $css .= ".{$class} .portfolio-item-overlay{background-color: rgba(red({$color}), green({$color}), blue({$color}), 0.7) !important;}";
            }
        }
        $css = $less->compile($css);
        drupal_add_css($css, array('type' => 'inline'));
    }
}
Exemple #5
0
function bootstork_preprocess_html(&$variables)
{
    //puts user roles into html tag
    foreach ($variables['user']->roles as $role) {
        $variables['classes_array'][] = 'role-' . drupal_html_class($role);
    }
}
Exemple #6
0
 /**
  * {@inheritdoc}
  */
 public function preBuild(array &$build, ObjectInterface $context = NULL)
 {
     $map_id = $context->getId();
     $layers = $this->getOption('layers', array());
     $items = array();
     $map_layers = $context->getObjects('layer');
     $element_type = $this->getOption('multiselect', FALSE) ? 'checkbox' : 'radio';
     // Only handle layers available in the map and configured in the control.
     // @TODO: use Form API (with form_process_* and stuff)
     $labels = $this->getOption('layer_labels', array());
     foreach ($map_layers as $i => $map_layer) {
         if (isset($layers[$map_layer->getMachineName()])) {
             $classes = array(drupal_html_class($map_layer->getMachineName()));
             $checked = '';
             if ($element_type == 'checkbox') {
                 if ($map_layer->getOption('visible', 1)) {
                     $checked = 'checked ';
                     $classes[] = 'active';
                 }
             }
             $label = $map_layer->getName();
             if (isset($labels[$map_layer->getMachineName()])) {
                 $label = openlayers_i18n_string('openlayers:layerswitcher:' . $this->getMachineName() . ':' . $map_layer->getMachineName() . ':label', $labels[$map_layer->getMachineName()], array('sanitize' => TRUE));
             }
             $items[] = array('data' => '<label><input type="' . $element_type . '" name="layer" ' . $checked . 'value="' . $map_layer->getMachineName() . '">' . $label . '</label>', 'id' => drupal_html_id($map_id . '-' . $map_layer->getMachineName()), 'class' => $classes);
         }
     }
     $title = openlayers_i18n_string('openlayers:layerswitcher:' . $this->getMachineName() . ':title', $this->getOption('label', 'Layers'), array('sanitize' => TRUE));
     $layerswitcher = array('#theme' => 'item_list', '#type' => 'ul', '#title' => $title, '#items' => $items, '#attributes' => array('id' => drupal_html_id($this->getMachineName() . '-items')));
     $this->setOption('element', '<div id="' . drupal_html_id($this->getMachineName()) . '" class="' . drupal_html_class($this->getMachineName()) . ' layerswitcher">' . drupal_render($layerswitcher) . '</div>');
     // Allow the parent class to perform it's pre-build actions.
     parent::preBuild($build, $context);
 }
Exemple #7
0
/**
 * Implements template_preprocess_node().
 */
function glisseo_preprocess_node(&$variables)
{
    $is_contextual = in_array('contextual-links-region', $variables['classes_array']);
    // Clear default classes.
    if (theme_get_setting('glisseo_replace_node_classes')) {
        $variables['classes_array'] = array();
        $variables['classes_array'][] = drupal_html_class($variables['type'] . '-' . $variables['view_mode']);
        // If content is sticky, we add special class.
        if ($variables['sticky']) {
            $variables['classes_array'][] = drupal_html_class('sticky');
        }
        // We add that class only when contextual links enabled.
        if ($is_contextual) {
            $variables['classes_array'][] = drupal_html_class('contextual-links-region');
        }
    }
    // Work with Node object.
    $node = $variables['node'];
    // Save field values to variables.
    foreach ($node as $label => $data) {
        // Is label is field.
        if (preg_match("/field_(.*)?/i", $label, $matches)) {
            $variables[$label] = field_get_items('node', $node, $label);
        }
    }
}
Exemple #8
0
/**
 * Adds CSS classes based on user roles
 * Implements template_preprocess_html().
 *
 */
function foundation_access_preprocess_html(&$variables)
{
    // loop through our system specific colors
    $colors = array('primary', 'secondary', 'required', 'optional');
    $css = '';
    foreach ($colors as $current) {
        $color = theme_get_setting('foundation_access_' . $current . '_color');
        // allow other projects to override the FA colors
        drupal_alter('foundation_access_colors', $color, $current);
        // see if we have something that could be valid hex
        if (strlen($color) == 6 || strlen($color) == 3) {
            $complement = '#' . _foundation_access_complement($color);
            $color = '#' . $color;
            $css .= '.foundation_access-' . $current . "_color{color:{$color};}";
            // specialized additions for each wheel value
            switch ($current) {
                case 'primary':
                    $css .= ".etb-book h1,.etb-book h2 {color: {$color};}";
                    break;
                case 'secondary':
                    $css .= ".etb-book h3,.etb-book h4,.etb-book h5 {color: {$color};}";
                    break;
                case 'required':
                    $css .= "div.textbook_box_required li:hover:before{border-color: {$color};} div.textbook_box_required li:before {color: {$complement}; background: {$color};} div.textbook_box_required { border: 2px solid {$color};} .textbook_box_required h3 {color: {$color};}";
                    break;
                case 'optional':
                    $css .= "div.textbook_box_optional li:hover:before{border-color: {$color};} div.textbook_box_optional li:before {color: {$complement}; background: {$color};} div.textbook_box_optional { border: 2px solid {$color};} .textbook_box_optional h3 {color: {$color};}";
                    break;
            }
        }
    }
    drupal_add_css($css, array('type' => 'inline', 'group' => CSS_THEME, 'weight' => 1000));
    drupal_add_css('//fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic|Open+Sans:300,600,700)', array('type' => 'external', 'group' => CSS_THEME));
    // theme path shorthand should be handled here
    $variables['theme_path'] = base_path() . drupal_get_path('theme', 'foundation_access');
    foreach ($variables['user']->roles as $role) {
        $variables['classes_array'][] = 'role-' . drupal_html_class($role);
    }
    // add page level variables into scope for the html tpl file
    $variables['site_name'] = check_plain(variable_get('site_name', 'ELMSLN'));
    $variables['logo'] = theme_get_setting('logo');
    $variables['logo_img'] = '';
    // make sure we have a logo before trying to render a real one to screen
    if (!empty($variables['logo'])) {
        $variables['logo_img'] = l(theme('image', array('path' => $variables['logo'], 'alt' => strip_tags($variables['site_name']) . ' ' . t('logo'), 'title' => strip_tags($variables['site_name']) . ' ' . t('Home'), 'attributes' => array('class' => array('logo__img')))), '<front>', array('html' => TRUE));
    }
    // add logo style classes to the logo element
    $logo_classes = array();
    $logo_option = theme_get_setting('foundation_access_logo_options');
    if (isset($logo_option) && !is_null($logo_option)) {
        $logo_classes[] = 'logo--' . $logo_option;
    }
    $variables['logo_classes'] = implode(' ', $logo_classes);
    // support in-domain XSS exceptions
    if (module_exists('cis_connector')) {
        $variables['parent_origin'] = _cis_connector_parent_domain();
    }
}
Exemple #9
0
/**
 * Preprocess variables for the html template.
 */
function outreach_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Add a class for the active color scheme
    if (module_exists('color')) {
        $class = check_plain(get_color_scheme_name($theme_name));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
}
/**
 * Get the section class.
 *
 * @return string
 */
function _base_get_section_class()
{
    $class = '';
    // Add the Page's first argument as body class.
    $path_arguments = explode('/', drupal_get_path_alias(implode('/', arg())));
    if (isset($path_arguments[0])) {
        $class = drupal_html_class($path_arguments[0]);
    }
    return $class;
}
Exemple #11
0
function boson_preprocess_html(&$vars)
{
    $bgklasa = theme_get_setting('theme_bg_pattern');
    $vars['classes_array'][] = drupal_html_class($bgklasa);
    drupal_add_css(path_to_theme() . '/css/main.css');
    //Add PinIt JS
    drupal_add_js('http://assets.pinterest.com/js/pinit.js');
    // The Color Palette.
    $file = theme_get_setting('theme_color_palette');
    drupal_add_css(path_to_theme() . '/css/color-scheme/' . $file . '.css');
}
Exemple #12
0
/**
 * Override or insert variables into the html template.
 */
function pixture_reloaded_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = 'pixture_reloaded';
    $path_to_theme = drupal_get_path('theme', $theme_name);
    // Load the media queries styles
    $media_queries_css = array($theme_name . '.responsive.style.css', $theme_name . '.responsive.gpanels.css');
    load_subtheme_media_queries($media_queries_css, $theme_name);
    // Add a class for the active color scheme
    if (module_exists('color')) {
        $class = check_plain(get_color_scheme_name($theme_key));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_key);
    // Add theme settings classes
    $settings_array = array('font_size', 'box_shadows', 'body_background', 'menu_bullets', 'menu_bar_position', 'corner_radius', 'image_alignment');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = theme_get_setting($setting);
    }
    // Fonts
    $fonts = array('bf' => 'base_font', 'snf' => 'site_name_font', 'ssf' => 'site_slogan_font', 'ptf' => 'page_title_font', 'ntf' => 'node_title_font', 'ctf' => 'comment_title_font', 'btf' => 'block_title_font');
    $families = get_font_families($fonts, $theme_key);
    if (!empty($families)) {
        foreach ($families as $family) {
            $vars['classes_array'][] = $family;
        }
    }
    // Add Noggin module settings extra classes, not all designs can support header images
    if (module_exists('noggin')) {
        if (variable_get('noggin:use_header', FALSE)) {
            $va = theme_get_setting('noggin_image_vertical_alignment');
            $ha = theme_get_setting('noggin_image_horizontal_alignment');
            $vars['classes_array'][] = 'ni-a-' . $va . $ha;
            $vars['classes_array'][] = theme_get_setting('noggin_image_repeat');
            $vars['classes_array'][] = theme_get_setting('noggin_image_width');
        }
    }
    // Special case for PIE htc rounded corners, not all themes include this
    if (theme_get_setting('ie_corners') == 1) {
        drupal_add_css($path_to_theme . '/css/ie-htc.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
    }
    // Headings styles
    if (theme_get_setting('headings_styles_caps') == 1) {
        $vars['classes_array'][] = 'hs-caps';
    }
    if (theme_get_setting('headings_styles_weight') == 1) {
        $vars['classes_array'][] = 'hs-fwn';
    }
    if (theme_get_setting('headings_styles_shadow') == 1) {
        $vars['classes_array'][] = 'hs-ts';
    }
}
Exemple #13
0
/**
 * Just use the theme function to translate order total
 */
function md_hosoren_commerce_price_formatted_components($variables)
{
    // Override default commerce Order total title
    $variables['components']['commerce_price_formatted_amount']['title'] = t('Order total');
    // Add the CSS styling to the table.
    drupal_add_css(drupal_get_path('module', 'commerce_price') . '/theme/commerce_price.theme.css');
    // Build table rows out of the components.
    $rows = array();
    foreach ($variables['components'] as $name => $component) {
        $rows[] = array('data' => array(array('data' => $component['title'], 'class' => array('component-title')), array('data' => $component['formatted_price'], 'class' => array('component-total'))), 'class' => array(drupal_html_class('component-type-' . $name)));
    }
    return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('commerce-price-formatted-components'))));
}
Exemple #14
0
function koop2_menu_link__main_menu($variables)
{
    $element = $variables['element'];
    $sub_menu = '';
    // Add menu-item name as class
    $element['#attributes']['class'][] = drupal_html_class($element['#title']);
    if (in_array('active-trail', $element['#attributes']['class']) || in_array('active', $element['#attributes']['class'])) {
        $element['#attributes']['class'][] = 'selected';
    }
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . '</li>';
}
/**
 * Pre-processes variables for the "bootstrap_modal" theme hook.
 *
 * See template for list of available variables.
 *
 * @see bootstrap-modal.tpl.php
 *
 * @ingroup theme_preprocess
 *
 * @todo: Replace with "bootstrap_effect_fade" theme setting.
 */
function bootstrap_preprocess_bootstrap_modal(&$variables)
{
    if (empty($variables['attributes']['id'])) {
        $variables['attributes']['id'] = drupal_html_id(strip_tags($variables['heading']));
    }
    $variables['attributes']['class'][] = 'modal';
    $variables['attributes']['class'][] = 'fade';
    $variables['attributes']['tabindex'] = -1;
    $variables['attributes']['role'] = 'dialog';
    $variables['attributes']['aria-hidden'] = 'true';
    $variables['heading'] = $variables['html_heading'] ? $variables['heading'] : check_plain($variables['heading']);
    $variables['dialog_attributes']['class'][] = 'modal-dialog';
    if (!empty($variables['size'])) {
        $variables['dialog_attributes']['class'][] = drupal_html_class('modal-' . $variables['size']);
    }
}
Exemple #16
0
function themekit_preprocess_html(&$variables)
{
    //if context_layouts module exist, append active layout class to body
    if (module_exists('context_layouts') && ($layout = context_layouts_get_active_layout())) {
        $variables['classes_array'][] = drupal_html_class('layout-' . $layout['layout']);
    }
    $html5_respond_meta = theme_get_setting('zen_html5_respond_meta');
    // Add selectivizr.js based on theme settings.
    if (isset($html5_respond_meta['selectivizr']) && $html5_respond_meta['selectivizr']) {
        drupal_add_js(drupal_get_path('theme', 'themekit') . '/js/selectivizr-min.js', array('group' => JS_THEME));
    }
    // Set js and css paths.
    $js_path = drupal_get_path('theme', 'themekit') . '/js/';
    $css_path = drupal_get_path('theme', 'themekit') . '/css/';
    themekit_add_assets($js_path, $css_path, array('js_filename' => 'theme.js', 'js_filename_min' => 'theme.min.js', 'css_filename' => 'style.css'));
}
Exemple #17
0
/**
 * Implements theme_file_styles_image().
 */
function rhok_file_styles_image($variables)
{
    $json = $variables['instance']->object->override['json'];
    $output = '<div class="media-image format-' . drupal_html_class($json['image-style']) . ' align-' . $json['align'] . '">';
    if (isset($json['image-style'])) {
        $output .= '<div class="image">' . theme('image_style', array('style_name' => $json['image-style'], 'path' => $variables['image_uri'], 'alt' => $variables['alt'], 'title' => $variables['title'], 'getsize' => FALSE, 'attributes' => $variables['attributes'])) . '</div>';
    } else {
        $output .= '<div class="image">' . theme('image', array('path' => $variables['image_uri'], 'alt' => $variables['alt'], 'title' => $variables['title'], 'getsize' => FALSE, 'attributes' => $variables['attributes'])) . '</div>';
    }
    if ($json['caption']) {
        $output .= '<div class="caption">' . check_plain($json['caption']) . '</div>';
    }
    // if
    $output .= '</div>';
    return $output;
}
 /**
  * Tests default and custom block categories.
  */
 public function testBlockCategory()
 {
     $this->drupalLogin($this->drupalCreateUser(array('administer views', 'administer blocks')));
     // Create a new view in the UI.
     $edit = array();
     $edit['label'] = $this->randomString();
     $edit['id'] = strtolower($this->randomMachineName());
     $edit['show[wizard_key]'] = 'standard:views_test_data';
     $edit['description'] = $this->randomString();
     $edit['block[create]'] = TRUE;
     $edit['block[style][row_plugin]'] = 'fields';
     $this->drupalPostForm('admin/structure/views/add', $edit, t('Save and edit'));
     // Test that the block was given a default category corresponding to its
     // base table.
     $arguments = array(':id' => 'edit-category-lists-views', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1', ':href' => \Drupal::Url('block.admin_add', array('plugin_id' => 'views_block:' . $edit['id'] . '-block_1', 'theme' => 'stark')), ':text' => $edit['label']);
     $this->drupalGet('admin/structure/block');
     $elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
     $this->assertTrue(!empty($elements), 'The test block appears in the category for its base table.');
     // Duplicate the block before changing the category.
     $this->drupalPostForm('admin/structure/views/view/' . $edit['id'] . '/edit/block_1', array(), t('Duplicate @display_title', array('@display_title' => 'Block')));
     $this->assertUrl('admin/structure/views/view/' . $edit['id'] . '/edit/block_2');
     // Change the block category to a random string.
     $this->drupalGet('admin/structure/views/view/' . $edit['id'] . '/edit/block_1');
     $label = t('Lists (Views)');
     $link = $this->xpath('//a[@id="views-block-1-block-category" and normalize-space(text())=:label]', array(':label' => $label));
     $this->assertTrue(!empty($link));
     $this->clickLink($label);
     $category = $this->randomString();
     $this->drupalPostForm(NULL, array('block_category' => $category), t('Apply'));
     // Duplicate the block after changing the category.
     $this->drupalPostForm(NULL, array(), t('Duplicate @display_title', array('@display_title' => 'Block')));
     $this->assertUrl('admin/structure/views/view/' . $edit['id'] . '/edit/block_3');
     $this->drupalPostForm(NULL, array(), t('Save'));
     // Test that the blocks are listed under the correct categories.
     $category_id = drupal_html_id('edit-category-' . String::checkPlain($category));
     $arguments[':id'] = $category_id;
     $this->drupalGet('admin/structure/block');
     $elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
     $this->assertTrue(!empty($elements), 'The test block appears in the custom category.');
     $arguments = array(':id' => 'edit-category-lists-views', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2', ':href' => \Drupal::Url('block.admin_add', array('plugin_id' => 'views_block:' . $edit['id'] . '-block_2', 'theme' => 'stark')), ':text' => $edit['label']);
     $elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
     $this->assertTrue(!empty($elements), 'The first duplicated test block remains in the original category.');
     $arguments = array(':id' => $category_id, ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-3', ':href' => \Drupal::Url('block.admin_add', array('plugin_id' => 'views_block:' . $edit['id'] . '-block_3', 'theme' => 'stark')), ':text' => $edit['label']);
     $elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
     $this->assertTrue(!empty($elements), 'The second duplicated test block appears in the custom category.');
 }
Exemple #19
0
/**
 * Override or insert variables into the html template.
 */
function ibm_apim_theme_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Add a class for the active color scheme
    if (module_exists('color')) {
        $class = check_plain(get_color_scheme_name($theme_name));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_name);
    // Add theme settings classes
    $settings_array = array('box_shadows', 'body_background', 'menu_bullets', 'menu_bar_position', 'content_corner_radius', 'tabs_corner_radius');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = at_get_setting($setting);
    }
}
Exemple #20
0
/**
 * Preprocess variables for html.tpl.php.
 */
function doune_preprocess_html(&$vars)
{
    // Borrowed from AdaptiveTheme
    $vars['rdf'] = new stdClass();
    if (module_exists('rdf')) {
        $vars['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
        $vars['rdf']->version = ' version="HTML+RDFa 1.1"';
        $vars['rdf']->namespaces = $vars['rdf_namespaces'];
        $vars['rdf']->profile = ' profile="' . $vars['grddl_profile'] . '"';
    } else {
        $vars['doctype'] = '<!DOCTYPE html>' . "\n";
        $vars['rdf']->version = '';
        $vars['rdf']->namespaces = '';
        $vars['rdf']->profile = '';
    }
    // Add a class for the current layout
    $vars['classes_array'][] = drupal_html_class('layout-' . doune_active_layout());
}
/**
 * Override or insert variables into the html template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("html" in this case.)
 */
function genesis_preprocess_html(&$vars)
{
    // Additional body classes to help out themers.
    if (!$vars['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        list($section, ) = explode('/', $path, 2);
        if (arg(0) == 'node') {
            if (arg(1) == 'add') {
                $section = 'page-node-add';
            } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
                $section = 'page-node-' . arg(2);
            }
        }
        $vars['classes_array'][] = drupal_html_class('section-' . $section);
    }
}
Exemple #22
0
function eldir_preprocess_html(&$variables, $hook)
{
    $node = menu_get_object();
    if (!empty($node)) {
        $type = $node->type;
        $variables['classes_array'][] = " node-page";
        $variables['classes_array'][] = " ntype-{$type}";
    }
    // Add path-based class for a last line of defense
    $current_path = current_path();
    if (!empty($current_path)) {
        $variables['classes_array'][] = ' path-' . drupal_html_class(current_path());
    }
    // Add special body class for error pages
    #  if (menu_get_active_item() === 0) {
    #    $variables['body_classes'] .= ' error-page';
    #  }
}
Exemple #23
0
/**
 * Adds CSS classes based on user roles
 * Implements template_preprocess_html().
 *
 */
function foundation_access_preprocess_html(&$variables)
{
    // loop through our system specific colors
    $colors = array('primary', 'secondary', 'required', 'optional');
    $css = '';
    foreach ($colors as $current) {
        $color = theme_get_setting('foundation_access_' . $current . '_color');
        // see if we have something that could be valid hex
        if (strlen($color) == 6 || strlen($color) == 3) {
            $color = '#' . $color;
            $css .= '.foundation_access-' . $current . '_color{color:$color;}';
            // specialized additions for each wheel value
            switch ($current) {
                case 'primary':
                    $css .= ".etb-book h1,.etb-book h2 {color: {$color} !important;}";
                    break;
                case 'secondary':
                    $css .= ".etb-book h3,.etb-book h4,.etb-book h5 {color: {$color} !important;}";
                    break;
                case 'required':
                    $css .= "div.textbook_box_required li:hover:before{border-color: {$color} !important;} div.textbook_box_required li:before {background: {$color} !important;} div.textbook_box_required { border: 2px solid {$color} !important;} .textbook_box_required h3 {color: {$color} !important;}";
                    break;
                case 'optional':
                    $css .= "div.textbook_box_optional li:hover:before{border-color: {$color} !important;} div.textbook_box_optional li:before {background: {$color} !important;} div.textbook_box_optional { border: 2px solid {$color} !important;} .textbook_box_optional h3 {color: {$color} !important;}";
                    break;
            }
        }
    }
    drupal_add_css($css, array('type' => 'inline'));
    drupal_add_css('//fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic|Open+Sans:300,600,700)', array('type' => 'external'));
    // theme path shorthand should be handled here
    $variables['theme_path'] = base_path() . drupal_get_path('theme', 'foundation_access');
    foreach ($variables['user']->roles as $role) {
        $variables['classes_array'][] = 'role-' . drupal_html_class($role);
    }
    // add page level variables into scope for the html tpl file
    $variables['site_name'] = check_plain(variable_get('site_name', 'ELMSLN'));
    $variables['logo'] = theme_get_setting('logo');
    $variables['logo_img'] = '';
    // make sure we have a logo before trying to render a real one to screen
    if (!empty($variables['logo'])) {
        $variables['logo_img'] = l(theme('image', array('path' => $variables['logo'], 'alt' => strip_tags($variables['site_name']) . ' ' . t('logo'), 'title' => strip_tags($variables['site_name']) . ' ' . t('Home'), 'attributes' => array('class' => array('logo')))), '<front>', array('html' => TRUE));
    }
}
Exemple #24
0
/**
 * Override or insert variables into the html template.
 */
function sky_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = $theme_key;
    // Add a class for the active color scheme
    if (module_exists('color') && function_exists('get_color_scheme_name')) {
        $class = check_plain(get_color_scheme_name($theme_name));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_name);
    // Browser sniff and add a class, unreliable but quite useful
    // $vars['classes_array'][] = css_browser_selector();
    // Add theme settings classes
    $settings_array = array('box_shadows', 'body_background', 'menu_bullets', 'menu_bar_position', 'content_corner_radius', 'tabs_corner_radius');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = at_get_setting($setting);
    }
}
Exemple #25
0
/**
 * Implements hook_process_html().
 *
 * Process variables for html.tpl.php
 */
function ddbasic_process_html(&$vars)
{
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    if (!$vars['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        $section = explode('/', $path);
        $section = array_shift($section);
        $arg = explode('/', $_GET['q']);
        if ($arg[0] == 'node' && isset($arg[1])) {
            if ($arg[1] == 'add') {
                $section = 'node-add';
            } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
                $section = 'node-' . $arg[2];
            }
        }
        $vars['classes_array'][] = drupal_html_class('section-' . $section);
    }
    // Store the menu item since it has some useful information.
    $vars['menu_item'] = menu_get_item();
    if ($vars['menu_item']) {
        switch ($vars['menu_item']['page_callback']) {
            case 'views_page':
                // Is this a Views page?
                $vars['classes_array'][] = 'page-views';
                break;
            case 'page_manager_page_execute':
            case 'page_manager_node_view':
            case 'page_manager_contact_site':
                // Is this a Panels page?
                $vars['classes_array'][] = 'page-panels';
                break;
        }
    }
    // Color module.
    // Hook into color.module.
    if (module_exists('color')) {
        _color_html_alter($vars);
    }
}
Exemple #26
0
function neb_file_link($variables)
{
    $file = $variables['file'];
    // $icon_directory = $variables['icon_directory'];
    $url = file_create_url($file->uri);
    $icon = theme('file_icon', array('file' => $file));
    // Set options as per anchor format described at
    // http://microformats.org/wiki/file-format-examples
    $options = array('attributes' => array('type' => $file->filemime . '; length=' . $file->filesize));
    // Use the description as the link text if available.
    if (empty($file->description)) {
        $link_text = $file->filename;
    } else {
        $link_text = $file->description;
        $options['attributes']['title'] = check_plain($file->filename);
    }
    $mimeclass = 'mime-' . drupal_html_class($file->filemime);
    $options['attributes']['class'] = array('file-icon', $mimeclass);
    return '<div class="file">' . l($link_text, $url, $options) . '</div>';
}
/**
 * local task classes
 */
function basetpl_menu_local_task($variables)
{
    $element = $variables['element'];
    $link = $element['#link'];
    $link_text = $link['title'];
    if (isset($link['path'])) {
        $path = explode('/', $link['path']);
        $class = end($path);
        $link['localized_options']['attributes']['class'][] = drupal_html_class('local-task-' . $class);
    }
    if (!empty($element['#active'])) {
        $active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
        if (empty($link['localized_options']['html'])) {
            $link['title'] = check_plain($link['title']);
        }
        $link['localized_options']['html'] = TRUE;
        $link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active));
    }
    return '<li' . (!empty($element['#active']) ? ' class="active"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . '</li>';
}
Exemple #28
0
 /**
  * Overrides Drupal\Core\Entity\EntityForm::form().
  */
 public function form(array $form, array &$form_state)
 {
     /** @var \Drupal\node\NodeInterface $node */
     $node = $this->entity;
     if ($this->operation == 'edit') {
         $form['#title'] = $this->t('<em>Edit @type</em> @title', array('@type' => node_get_type_label($node), '@title' => $node->label()));
     }
     $current_user = \Drupal::currentUser();
     $user_config = \Drupal::config('user.settings');
     // Some special stuff when previewing a node.
     if (isset($form_state['node_preview'])) {
         $form['#prefix'] = $form_state['node_preview'];
         $node->in_preview = TRUE;
         $form['#title'] = $this->t('Preview');
     } else {
         unset($node->in_preview);
     }
     // Override the default CSS class name, since the user-defined node type
     // name in 'TYPE-node-form' potentially clashes with third-party class
     // names.
     $form['#attributes']['class'][0] = drupal_html_class('node-' . $node->getType() . '-form');
     // Changed must be sent to the client, for later overwrite error checking.
     $form['changed'] = array('#type' => 'hidden', '#default_value' => $node->getChangedTime());
     $language_configuration = \Drupal::moduleHandler()->invoke('language', 'get_default_configuration', array('node', $node->getType()));
     $form['langcode'] = array('#title' => t('Language'), '#type' => 'language_select', '#default_value' => $node->getUntranslated()->language()->id, '#languages' => LanguageInterface::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show']);
     $form['advanced'] = array('#type' => 'vertical_tabs', '#attributes' => array('class' => array('entity-meta')), '#weight' => 99);
     // Add a revision log field if the "Create new revision" option is checked,
     // or if the current user has the ability to check that option.
     $form['revision_information'] = array('#type' => 'details', '#group' => 'advanced', '#title' => t('Revision information'), '#open' => $node->isNewRevision(), '#attributes' => array('class' => array('node-form-revision-information')), '#attached' => array('library' => array('node/drupal.node')), '#weight' => 20, '#optional' => TRUE);
     $form['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => !empty($this->settings['options']['revision']), '#access' => $node->isNewRevision() || $current_user->hasPermission('administer nodes'), '#group' => 'revision_information');
     $form['revision_log'] = array('#type' => 'textarea', '#title' => t('Revision log message'), '#rows' => 4, '#default_value' => !empty($node->revision_log->value) ? $node->revision_log->value : '', '#description' => t('Briefly describe the changes you have made.'), '#states' => array('visible' => array(':input[name="revision"]' => array('checked' => TRUE))), '#group' => 'revision_information', '#access' => $node->isNewRevision() || $current_user->hasPermission('administer nodes'));
     // Node author information for administrators.
     $form['author'] = array('#type' => 'details', '#title' => t('Authoring information'), '#group' => 'advanced', '#attributes' => array('class' => array('node-form-author')), '#attached' => array('library' => array('node/drupal.node'), 'js' => array(array('type' => 'setting', 'data' => array('anonymous' => $user_config->get('anonymous'))))), '#weight' => 90, '#optional' => TRUE);
     $form['uid'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_route_name' => 'user.autocomplete', '#default_value' => $node->getOwnerId() ? $node->getOwner()->getUsername() : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => $user_config->get('anonymous'))), '#group' => 'author', '#access' => $current_user->hasPermission('administer nodes'));
     $form['created'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? date_format(date_create($node->date), 'Y-m-d H:i:s O') : format_date($node->getCreatedTime(), 'custom', 'Y-m-d H:i:s O'), '%timezone' => !empty($node->date) ? date_format(date_create($node->date), 'O') : format_date($node->getCreatedTime(), 'custom', 'O'))), '#default_value' => !empty($node->date) ? $node->date : '', '#group' => 'author', '#access' => $current_user->hasPermission('administer nodes'));
     // Node options for administrators.
     $form['options'] = array('#type' => 'details', '#title' => t('Promotion options'), '#group' => 'advanced', '#attributes' => array('class' => array('node-form-options')), '#attached' => array('library' => array('node/drupal.node')), '#weight' => 95, '#optional' => TRUE);
     $form['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->isPromoted(), '#group' => 'options', '#access' => $current_user->hasPermission('administer nodes'));
     $form['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->isSticky(), '#group' => 'options', '#access' => $current_user->hasPermission('administer nodes'));
     return parent::form($form, $form_state, $node);
 }
Exemple #29
0
/**
 * Override or insert vars into the html template.
 */
function corolla_preprocess_html(&$vars)
{
    global $theme_key;
    $theme_name = 'corolla';
    // Load the media queries styles
    $media_queries_css = array($theme_name . '.responsive.style.css', $theme_name . '.responsive.gpanels.css');
    load_subtheme_media_queries($media_queries_css, $theme_name);
    // Load IE specific stylesheets
    $ie_files = array('lte IE 9' => 'ie-lte-9.css');
    load_subtheme_ie_styles($ie_files, $theme_name);
    // Add a class for the active color scheme
    if (module_exists('color')) {
        $class = check_plain(get_color_scheme_name($theme_key));
        $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
    }
    // Add class for the active theme
    $vars['classes_array'][] = drupal_html_class($theme_key);
    // Add theme settings classes
    $settings_array = array('font_size', 'box_shadows', 'body_background', 'menu_bullets', 'content_corner_radius', 'tabs_corner_radius', 'image_alignment');
    foreach ($settings_array as $setting) {
        $vars['classes_array'][] = theme_get_setting($setting);
    }
    // Fonts
    $fonts = array('bf' => 'base_font', 'snf' => 'site_name_font', 'ssf' => 'site_slogan_font', 'ptf' => 'page_title_font', 'ntf' => 'node_title_font', 'ctf' => 'comment_title_font', 'btf' => 'block_title_font');
    $families = get_font_families($fonts, $theme_key);
    if (!empty($families)) {
        foreach ($families as $family) {
            $vars['classes_array'][] = $family;
        }
    }
    // Heading styles
    if (theme_get_setting('headings_styles_caps') == 1) {
        $vars['classes_array'][] = 'hs-caps';
    }
    if (theme_get_setting('headings_styles_weight') == 1) {
        $vars['classes_array'][] = 'hs-fwn';
    }
    if (theme_get_setting('headings_styles_shadow') == 1) {
        $vars['classes_array'][] = 'hs-ts';
    }
}
Exemple #30
0
function bseurope_preprocess_html(&$vars)
{
    $bgklasa = theme_get_setting('theme_bg_pattern');
    $vars['classes_array'][] = drupal_html_class($bgklasa);
    drupal_add_css(path_to_theme() . '/css/main.css');
    //Add PinIt JS
    drupal_add_js('http://assets.pinterest.com/js/pinit.js');
    // The Color Palette.
    $file = theme_get_setting('theme_color_palette');
    drupal_add_css(path_to_theme() . '/css/color-scheme/' . $file . '.css');
    // Add context to main menu links
    if (array_key_exists('superfish_3', $vars['page']['main_menu'])) {
        //$vars['page']['main_menu']['superfish_3']["#markup"] = str_replace('/experiencias','/'.variable_get('europe_context','europa').'/experiencias', $vars['page']['main_menu']['superfish_3']["#markup"]);
        //$vars['page']['main_menu']['superfish_3']["#markup"] = str_replace('/experiences','/'.variable_get('europe_context','europa').'/highlights', $vars['page']['main_menu']['superfish_3']["#markup"]);
        //$vars['page']['main_menu']['superfish_3']["#markup"] = str_replace('/highlights','/'.variable_get('europe_context','europa').'/highlights', $vars['page']['main_menu']['superfish_3']["#markup"]);
        //$vars['page']['main_menu']['superfish_3']["#markup"] = str_replace('/contact','/'.variable_get('europe_context','europa').'/contact', $vars['page']['main_menu']['superfish_3']["#markup"]);
    }
    if (array_key_exists('4465', $vars['page']['footer_thirdcolumn']['menu_menu-otros'])) {
        $vars['page']['footer_thirdcolumn']['menu_menu-otros']['4465']["#href"] = str_replace('/ofertas-viajes', '/' . variable_get('europe_context', 'europa') . '/ofertas-viajes', $vars['page']['footer_thirdcolumn']['menu_menu-otros']['4465']["#href"]);
    }
}