예제 #1
1
/**
 * Implements hook_preprocess_page().
 */
function uconn_theme_preprocess_page(&$variables)
{
    $path = current_path();
    $path_array = explode("/", $path);
    // Add script to the front page, to control the height of the three columns at the bottom.
    // Does not work natively in Zen grids, so this is required.
    if (drupal_is_front_page()) {
        $theme_path = drupal_get_path('theme', $GLOBALS['theme']);
        drupal_add_js("{$theme_path}/js/jquery.matchHeight-min.js");
        drupal_add_js("{$theme_path}/js/matchHeightBehaviour.js");
    }
    // Selectively add class to content, edge case requires particular
    // Styling on the search result page. Set here so it is always
    // Available.
    $variables['inner_page_wrapper'] = "";
    if (count($path_array) >= 2) {
        if ($path_array[0] == 'islandora' && $path_array[1] == 'search') {
            global $_islandora_solr_queryclass;
            $sr = new IslandoraSolrResults();
            $secondary_display_profiles = $sr->addSecondaries($_islandora_solr_queryclass);
            $default_rss_icon_location = "/sites/all/modules/islandora_solr_search/islandora_solr_config/images/rss.png";
            $new_rss_icon_location = "/" . drupal_get_path('theme', 'uconn_theme') . '/images/rss_w.png';
            $secondary_display_profiles = str_replace($default_rss_icon_location, $new_rss_icon_location, $secondary_display_profiles);
            if (isset($secondary_display_profiles)) {
                $variables['secondary_display_profiles'] = $secondary_display_profiles;
            }
            $variables['inner_page_wrapper'] = "inner-page-wrapper";
        }
    }
}
예제 #2
0
/**
 * Override of theme_breadcrumb().
 */
function aap_theme_breadcrumb($variables)
{
    $breadcrumb = $variables['breadcrumb'];
    $page_node = menu_get_object();
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">' . implode(' <p>></p> ', $breadcrumb);
    if (!empty($breadcrumb)) {
        if (!empty($page_node)) {
            $target = current_path();
            $target_text = substr($page_node->title, 0, 50) . '...';
            $target_link = l($target_text, drupal_get_path_alias($target));
            $content = $page_node->type;
            $target_content = l($content, drupal_get_path_alias($content));
            //	$output .=  '<p>></p>' . $target_content;
            $output .= '<p>></p>' . $target_link;
        } else {
            $target = current_path();
            $path_alias = drupal_get_path_alias($target);
            $target_link = l(drupal_get_path_alias($target), drupal_get_path_alias($target));
            $output .= '<p>></p>' . $target_link;
        }
        // Provide a navigational heading to give context for breadcrumb links to
        // screen-reader users. Make the heading invisible with .element-invisible.
        $output .= '</div>';
        return $output;
    }
}
function gettysw_preprocess_page(&$vars)
{
    switch (current_path()) {
        case 'user':
            if (isset($vars['tabs'])) {
                $vars['tabs'] = null;
                $vars['title_hidden'] = 1;
                break;
            }
        case 'user/register':
            if (isset($vars['tabs'])) {
                $vars['title_hidden'] = 1;
                $vars['tabs'] = null;
                break;
            }
        case 'user/password':
            drupal_set_title('Request a new password');
            if (isset($vars['tabs'])) {
                $vars['tabs'] = null;
                break;
            }
        default:
            break;
    }
}
예제 #4
0
파일: Create.php 프로젝트: moiseh/codegen
 public function __construct($meta = array())
 {
     $this->label = t('Create new');
     $this->icon = 'glyphicon-new-window';
     $this->url = url(current_path(), array('action' => 'add'));
     parent::__construct($meta);
 }
예제 #5
0
/**
* Overrides the theme_field for field_fb_tags to make it clickable and link to the Event Space (this will change).
*/
function storyscopezen_field__field_fb_tags($variables)
{
    if ($node = menu_get_object()) {
        // Get the nid
        $nid = $node->nid;
    }
    $output = '';
    $show_all = '';
    $path = drupal_lookup_path('alias', current_path());
    if (!empty($variables['items'][0])) {
        $show_all = l('<li class="tags">' . t('Show All') . '</li>', $path, array('html' => 'true', 'attributes' => array('target' => '_self'), 'query' => array('story' => $nid)));
        $output .= $show_all;
    }
    foreach ($variables['items'] as $item) {
        $fcid = key($item['entity']['field_collection_item']);
        if (!empty($item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup'])) {
            $mid = $item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup'];
        }
        if (!empty($item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup'])) {
            $topic = $item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup'];
        }
        if (!empty($mid) && !empty($topic)) {
            $id = explode('/', $mid);
            $lenth = count($id) - 1;
            $relative_mid = $id[$lenth];
            $tags_link = l('<li class="tags">' . $topic . '</li>', $path, array('html' => TRUE, 'attributes' => array('target' => '_self'), 'query' => array('tag' => '/m/' . $relative_mid)));
            $output .= $tags_link;
        } elseif (empty($mid) && !empty($topic)) {
            $output .= '<li class="tags freebase-link">' . $topic . '</li>';
        }
    }
    // Render the top-level UL.
    $output = '<ul class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</ul>';
    return $output;
}
예제 #6
0
파일: template.php 프로젝트: EWB/grh
function academy_delta_blocks_breadcrumb($variables)
{
    $output = '';
    if (!empty($variables['breadcrumb'])) {
        if ($variables['breadcrumb_current']) {
            $variables['breadcrumb'][] = l(drupal_get_title(), current_path(), array('html' => TRUE));
        }
        $output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
        $switch = array('odd' => 'even', 'even' => 'odd');
        $zebra = 'even';
        $last = count($variables['breadcrumb']) - 1;
        foreach ($variables['breadcrumb'] as $key => $item) {
            $zebra = $switch[$zebra];
            $attributes['class'] = array('depth-' . ($key + 1), $zebra);
            if ($key == 0) {
                $attributes['class'][] = 'first';
            }
            if ($key == $last) {
                $attributes['class'][] = 'last';
                $output .= '<li' . drupal_attributes($attributes) . $item . '</li>';
            } else {
                $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . ' <span class="breadcrumb-separator">&#xBB;</span> ';
            }
        }
        $output .= '</ul></div>';
    }
    return $output;
}
function boostrapdrupal_textfield($variables)
{
    $element = $variables['element'];
    $output = '';
    if ($element['#name'] == 'name' && current_path() == 'user/login') {
        $output = '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>';
    }
    $element['#attributes']['type'] = 'text';
    if (isset($variables['element']['#description'])) {
        $element['#attributes']['placeholder'] = $variables['element']['#description'];
    }
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
    _form_set_class($element, array('form-text', 'form-control', 'input-lg-3'));
    $extra = '';
    if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
        drupal_add_library('system', 'drupal.autocomplete');
        $element['#attributes']['class'][] = 'form-autocomplete';
        $attributes = array();
        $attributes['type'] = 'hidden';
        $attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
        $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
        $attributes['disabled'] = 'disabled';
        $attributes['class'][] = 'autocomplete';
        $extra = '<input' . drupal_attributes($attributes) . ' />';
    }
    $output .= '<input' . drupal_attributes($element['#attributes']) . ' />';
    if ($element['#name'] == 'name' && current_path() == 'user/login') {
        $output .= '</div>';
    }
    return $output . $extra;
}
예제 #8
0
파일: Pager.php 프로젝트: moiseh/codegen
 public static function sortLabel($colId, $label)
 {
     $args = url_args();
     $args['sort'] = $colId;
     $args['sortd'] = filter_input(INPUT_GET, 'sortd') == 'asc' ? 'desc' : 'asc';
     return anchor(current_path(), $label, $args);
 }
예제 #9
0
function ichado1_preprocess_page(&$vars)
{
    $a = 'a';
    $cur_path = current_path();
    $cur_path_alias = drupal_get_path_alias($cur_path);
    $add_breadcrumb = drupal_get_title();
    if ($cur_path == 'front') {
        drupal_add_js(drupal_get_path('theme', 'ichado1') . '/js/vktarget.js');
    }
    if ($cur_path == 'cart' || preg_match('/^checkout\\/[\\d]+$/', $cur_path) || preg_match('/^checkout\\/[\\d]+\\/complete$/', $cur_path) || preg_match('/^checkout\\/[\\d]+\\/review$/', $cur_path) || preg_match('/^news$/', $cur_path) || preg_match('/^o-nas$/', $cur_path_alias) || preg_match('/^kontakty$/', $cur_path_alias) || preg_match('/^kak-zakazat-0$/', $cur_path_alias) || preg_match('/^oplata$/', $cur_path_alias) || preg_match('/^dostavka$/', $cur_path_alias) || preg_match('/^garantii-vozvrata$/', $cur_path_alias) || $cur_path == 'user/register' || $cur_path == 'user/login') {
        $vars['title'] = '';
    }
    if ($cur_path == 'cart' || preg_match('/^checkout\\/[\\d]+$/', $cur_path) || preg_match('/^checkout\\/[\\d]+\\/review$/', $cur_path) || variable_get('auto_scroll', FALSE) || $cur_path == 'catalog' && preg_match('/cart/', $_SERVER['HTTP_REFERER'])) {
        drupal_add_js(drupal_get_path('theme', 'ichado1') . '/js/auto-scroll.js', 'file');
        variable_set('auto_scroll', FALSE);
    }
    if (preg_match('/catalog/', $cur_path) || preg_match('/catalog/', $cur_path_alias)) {
        libraries_load('jcarousel');
    }
    $vars['catalog_menu_drop'] = '';
    $context_get = context_get('context');
    if ($context_get && in_array('for_drop_down_menu', array_keys($context_get))) {
        $block = module_invoke('superfish', 'block_view', 1);
        $catalog_menu_drop = render($block['content']);
        $vars['catalog_menu_drop'] = $catalog_menu_drop;
    }
    /*
    drupal_add_js('//cdn.callbackhunter.com/cbh.js?hunter_code=7ab9ebf48fe3227cd14cdb9ba43f2cd5',
        array(
            'type'       => 'external',
            'scope'      => 'footer',
            'every_page' => TRUE,
        ));
    */
}
예제 #10
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);
}
예제 #11
0
/**
 * Implements hook_css_alter().
 */
function omega_css_alter(&$css)
{
    $omega = drupal_get_path('theme', 'omega');
    // The CSS_SYSTEM aggregation group doesn't make any sense. Therefore, we are
    // pre-pending it to the CSS_DEFAULT group. This has the same effect as giving
    // it a separate (low-weighted) group but also allows it to be aggregated
    // together with the rest of the CSS.
    foreach ($css as &$item) {
        if ($item['group'] == CSS_SYSTEM) {
            $item['group'] = CSS_DEFAULT;
            $item['weight'] = $item['weight'] - 100;
        }
    }
    // Clean up core and contrib module CSS.
    $overrides = array('aggregator' => array('aggregator.css' => array('theme' => 'aggregator.theme.css'), 'aggregator-rtl.css' => array('theme' => 'aggregator.theme-rtl.css')), 'block' => array('block.css' => array('admin' => 'block.admin.css', 'demo' => 'block.demo.css')), 'book' => array('book.css' => array('theme' => 'book.theme.css', 'admin' => 'book.admin.css'), 'book-rtl.css' => array('theme' => 'book.theme-rtl.css')), 'color' => array('color.css' => array('admin' => 'color.admin.css'), 'color-rtl.css' => array('admin' => 'color.admin-rtl.css')), 'comment' => array('comment.css' => array('theme' => 'comment.theme.css'), 'comment-rtl.css' => array('theme' => 'comment.theme-rtl.css')), 'contextual' => array('contextual.css' => array('base' => 'contextual.base.css', 'theme' => 'contextual.theme.css'), 'contextual-rtl.css' => array('base' => 'contextual.base-rtl.css', 'theme' => 'contextual.theme-rtl.css')), 'field' => array('theme/field.css' => array('theme' => 'field.theme.css'), 'theme/field-rtl.css' => array('theme' => 'field.theme-rtl.css')), 'field_ui' => array('field_ui.css' => array('admin' => 'field_ui.admin.css'), 'field_ui-rtl.css' => array('admin' => 'field_ui.admin-rtl.css')), 'file' => array('file.css' => array('theme' => 'file.theme.css')), 'filter' => array('filter.css' => array('theme' => 'filter.theme.css')), 'forum' => array('forum.css' => array('theme' => 'forum.theme.css'), 'forum-rtl.css' => array('theme' => 'forum.theme-rtl.css')), 'image' => array('image.css' => array('theme' => 'image.theme.css'), 'image-rtl.css' => array('theme' => 'image.theme-rtl.css'), 'image.admin.css' => array('admin' => 'image.admin.css')), 'locale' => array('locale.css' => array('admin' => 'locale.admin.css'), 'locale-rtl.css' => array('admin' => 'locale.admin-rtl.css')), 'openid' => array('openid.css' => array('base' => 'openid.base.css', 'theme' => 'openid.theme.css'), 'openid-rtl.css' => array('base' => 'openid.base-rtl.css', 'theme' => 'openid.theme-rtl.css')), 'poll' => array('poll.css' => array('admin' => 'poll.admin.css', 'theme' => 'poll.theme.css'), 'poll-rtl.css' => array('theme' => 'poll.theme-rtl.css')), 'search' => array('search.css' => array('theme' => 'search.theme.css'), 'search-rtl.css' => array('theme' => 'search.theme-rtl.css')), 'system' => array('system.base.css' => array('base' => 'system.base.css'), 'system.base-rtl.css' => array('base' => 'system.base-rtl.css'), 'system.theme.css' => array('theme' => 'system.theme.css'), 'system.theme-rtl.css' => array('theme' => 'system.theme-rtl.css'), 'system.admin.css' => array('admin' => 'system.admin.css'), 'system.admin-rtl.css' => array('admin' => 'system.admin-rtl.css'), 'system.menus.css' => array('theme' => 'system.menus.theme.css'), 'system.menus-rtl.css' => array('theme' => 'system.menus.theme-rtl.css'), 'system.messages.css' => array('theme' => 'system.messages.theme.css'), 'system.messages-rtl.css' => array('theme' => 'system.messages.theme-rtl.css')), 'taxonomy' => array('taxonomy.css' => array('admin' => 'taxonomy.admin.css')), 'user' => array('user.css' => array('base' => 'user.base.css', 'admin' => 'user.admin.css', 'theme' => 'user.theme.css'), 'user-rtl.css' => array('admin' => 'user.admin-rtl.css', 'theme' => 'user.theme-rtl.css')));
    // Check if we are on an admin page. Otherwise, we can skip admin CSS.
    $path = current_path();
    $types = path_is_admin($path) ? array('base', 'theme', 'admin') : array('base', 'theme');
    // Add a special case for the block demo page.
    $types = strpos($path, 'admin/structure/block/demo') === 0 ? array_merge($types, array('demo')) : $types;
    // Override module provided CSS with clean and modern alternatives provided
    // by Omega.
    foreach ($overrides as $module => $files) {
        // We gathered the CSS files with paths relative to the providing module.
        $path = drupal_get_path('module', $module);
        foreach ($files as $file => $items) {
            if (isset($css[$path . '/' . $file])) {
                // Keep a copy of the original file array so we can merge that with our
                // overrides in order to keep the 'weight' and 'group' declarations.
                $original = $css[$path . '/' . $file];
                unset($css[$path . '/' . $file]);
                // Omega 4.x tries to follow the pattern described in
                // http://drupal.org/node/1089868 for declaring CSS files. Therefore, it
                // may take more than a single file to override a .css file added by
                // core. This gives us better granularity when overriding .css files
                // in a sub-theme.
                foreach ($types as $type) {
                    if (isset($items[$type])) {
                        $css[$omega . '/css/modules/' . $module . '/' . $items[$type]] = array('data' => $omega . '/css/modules/' . $module . '/' . $items[$type]) + $original;
                    }
                }
            }
        }
    }
    // Exclude CSS files as declared in the theme settings.
    if (omega_extension_enabled('assets')) {
        omega_css_js_alter($css, 'css');
    }
    // Allow themes to specify no-query fallback CSS files.
    require_once "{$omega}/includes/assets.inc";
    $mapping = omega_assets_generate_mapping($css);
    foreach (preg_grep('/\\.no-query(-rtl)?\\.css$/', $mapping) as $key => $fallback) {
        // Don't modify browser settings if they have already been modified.
        if ($css[$key]['browsers']['IE'] === TRUE && $css[$key]['browsers']['!IE'] === TRUE) {
            $css[$key]['browsers'] = array('!IE' => FALSE, 'IE' => 'lte IE 8');
            // Make sure that we don't break any CSS aggregation groups.
            $css[$key]['weight'] += 100;
        }
    }
}
예제 #12
0
/**
 * @file
 * template.php
 */
function floyd_process_page(&$variables)
{
    // Hook into color.module.
    if (module_exists('color')) {
        _color_page_alter($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-md-6"';
    } elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
        $variables['content_column_class'] = ' class="col-md-9"';
    } else {
        $variables['content_column_class'] = ' class="col-md-12"';
    }
    if (isset($variables['title'])) {
        $variables['title'] = strip_tags(html_entity_decode($variables['title']));
    }
    if ((drupal_is_front_page() || current_path() == 'node/72' || current_path() == 'node/73') && isset($variables['title'])) {
        unset($variables['title']);
        $lat = is_null(theme_get_setting('map_lat')) ? '40.773328' : theme_get_setting('map_lat');
        $long = is_null(theme_get_setting('map_long')) ? '-73.960088' : theme_get_setting('map_long');
        drupal_add_js('http://maps.google.com/maps/api/js?sensor=true', 'external');
        $floyd_path = drupal_get_path('theme', 'floyd');
        drupal_add_js($floyd_path . '/js/gmap3.js');
        drupal_add_js("\n      function isMobile() { \n        return ('ontouchstart' in document.documentElement);\n      }\n      function init_gmap() {\n        if ( typeof google == 'undefined' ) return;\n        var styles = [\n        {\n          'featureType': 'water',\n          'stylers': [\n          {\n            'color': '#eee'\n          },\n          {\n            'visibility': 'on'\n          }\n          ]\n        },\n        {\n          'featureType': 'landscape',\n          'stylers': [\n          {\n            'color': '#f2f2f2'\n          }\n          ]\n        },\n        {\n          'featureType': 'road',\n          'stylers': [\n          {\n            'saturation': -100\n          },\n          {\n            'lightness': 45\n          }\n          ]\n        },\n        {\n          'featureType': 'road.highway',\n          'stylers': [\n          {\n            'visibility': 'simplified'\n          }\n          ]\n        },\n        {\n          'featureType': 'road.arterial',\n          'elementType': 'labels.icon',\n          'stylers': [\n          {\n            'visibility': 'off'\n          }\n          ]\n        },\n        {\n          'featureType': 'administrative',\n          'elementType': 'labels.text.fill',\n          'stylers': [\n          {\n            'color': '#444444'\n          }\n          ]\n        },\n        {\n          'featureType': 'transit',\n          'stylers': [\n          {\n            'visibility': 'off'\n          }\n          ]\n        },\n        {\n          'featureType': 'poi',\n          'stylers': [\n          {\n            'visibility': 'off'\n          }\n          ]\n        }\n       ]\n        var options = {\n          center: [" . $lat . ", " . $long . "],\n          zoom: 16,\n          mapTypeControl: false,\n          disableDefaultUI: true,\n          zoomControl: false,\n          scrollwheel: false,\n          styles: styles\n        }\n\n        if (isMobile()) {\n          options.draggable = false;\n        }\n        var pathToTheme = Drupal.settings.basePath + 'sites/all/themes/floyd';\n        var image = pathToTheme + '/images/mapicon.png';    \n\n        jQuery('#map').gmap3({\n          map: {\n            options: options\n          },\n          marker: {\n            latLng: [" . $lat . ", " . $long . "],\n            // options: { icon: image }\n          }\n        });\n      }\n      jQuery(document).ready(function() {\n        init_gmap();  \n      });\n      \n    ", 'inline');
    }
}
예제 #13
0
/**
 * Implements theme_process_page().
 */
function basetpl_process_page(&$variables)
{
    global $base_path;
    // show/hide breadcrumb
    $variables['show_breadcrumb'] = TRUE;
    // var theme_path
    $variables['theme_path'] = $base_path . path_to_theme();
    // var site_info
    $variables['site_info'] = $variables['logo'] || $variables['site_name'] || $variables['site_slogan'] ? TRUE : FALSE;
    // check if page is system page
    $variables['system_page'] = isset($variables['node']) ? FALSE : TRUE;
    // backend
    if (user_is_logged_in() && path_is_admin(current_path())) {
        $variables['site_info'] = FALSE;
        $variables['system_page'] = TRUE;
        foreach (element_children($variables['page']) as $region) {
            if ($region != 'content') {
                $variables['page'][$region] = FALSE;
            }
        }
    }
    // show/hide page title
    $variables['title'] = $variables['system_page'] ? $variables['title'] : FALSE;
    // add robots to head
    if (theme_get_setting('robots') == 1) {
        $robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex,nofollow'));
        drupal_add_html_head($robots, 'robots');
    }
}
예제 #14
0
 /**
  * {@inheritdoc}
  */
 public function form(array $form, FormStateInterface $form_state)
 {
     $user = $this->currentUser();
     /** @var \Drupal\user\UserInterface $account */
     $account = $this->entity;
     $admin = $user->hasPermission('administer users');
     // Pass access information to the submit handler. Running an access check
     // inside the submit function interferes with form processing and breaks
     // hook_form_alter().
     $form['administer_users'] = array('#type' => 'value', '#value' => $admin);
     // If we aren't admin but already logged on, go to the user page instead.
     if (!$admin && $user->isAuthenticated()) {
         return new RedirectResponse(url('user/' . \Drupal::currentUser()->id(), array('absolute' => TRUE)));
     }
     $form['#attached']['library'][] = 'core/drupal.form';
     $form['#attributes']['data-user-info-from-browser'] = TRUE;
     // Because the user status has security implications, users are blocked by
     // default when created programmatically and need to be actively activated
     // if needed. When administrators create users from the user interface,
     // however, we assume that they should be created as activated by default.
     if ($admin) {
         $account->activate();
     }
     // Start with the default user account fields.
     $form = parent::form($form, $form_state, $account);
     if ($admin) {
         // Redirect back to page which initiated the create request; usually
         // admin/people/create.
         $form_state['redirect'] = current_path();
     }
     return $form;
 }
예제 #15
0
/**
 * Implements hook_preprocess_page().
 */
function cignaglobal_preprocess_page(&$vars)
{
    if (isset($vars['node']->type)) {
        // Add hook suggestion based on node type.
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        // All broker urls begin with /brokers so use this fact to ensure pages
        // in this section use the page--brokers.tpl.php template.
        $is_broker_page = is_broker_page();
        if ($is_broker_page) {
            $vars['theme_hook_suggestions'][] = 'page__brokers';
            $vars['cigna_brokers_americas_tel_no'] = variable_get('cigna_brokers_americas_tel_no');
            $vars['cigna_brokers_europe_tel_no'] = variable_get('cigna_brokers_europe_tel_no');
            $vars['cigna_brokers_asia_pacific_tel_no'] = variable_get('cigna_brokers_asia_pacific_tel_no');
            $vars['cigna_broker_sales_email'] = variable_get('cigna_broker_sales_email');
            $vars['cigna_broker_service_email'] = variable_get('cigna_broker_service_email');
        }
    }
    // Add robots nofollow metatag for landing pages.
    $landing_page_urls = function_exists('cigna_lp_menu_keys') ? cigna_lp_menu_keys() : array();
    if (in_array(current_path(), $landing_page_urls)) {
        $data = array('#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex, nofollow'));
        drupal_add_html_head($data, 'cignaglobal_landing_page_no_follow');
    }
    // Site-wide variables.
    $vars['cigna_worldwide_tel_no'] = variable_get('cigna_worldwide_tel_no', '+44(0)1475 777625');
    $vars['cigna_usa_tel_no'] = variable_get('cigna_usa_tel_no', '877.539.6295');
}
예제 #16
0
function bluemod_init()
{
    //theme ( 'bluemod_javascript' );
    error_reporting(0);
    // Redirecciona a la pantalla de ingreso
    global $user;
    //Redirecciona a home a los usuarios anónimos.
    $curr = current_path();
    $anon_main = 0;
    $link_de_registro = substr_count($curr, 'user/reset/');
    $link_de_invitacion = substr_count($curr, 'invite/accept/');
    //echo $link_de_registro.','.$curr;
    if ($user->roles[1] == 'anonymous user' && $curr != 'escritorio') {
        //echo $curr;
        //Lista de excepciones que un usuario anónimo puede ver
        if ($curr != 'user/register' && $curr != 'user/password' && $curr != 'user/reset' && $curr != 'elegir-contactos' && $curr != 'node/374' && $curr != 'node/381' && $curr != 'node/228' && $curr != 'contact' && $curr != "system/ajax" && $link_de_registro == 0 && $link_de_invitacion == 0) {
            //echo $link_de_registro.','.$curr;
            //solo si no fuera el link de registro que tiene la forma user/reset/*
            // header("Location: /");
            //$mensaje = drupal_get_message(null,false);
            //drupal_set_message($mensaje);
            drupal_goto("<front>");
        }
    }
    if (arg(0) == 'user' && arg(1) == 'password') {
        drupal_set_title(t('Recupera tu Contraseña'));
    }
    if (arg(0) == 'user' && arg(1) == 'register') {
        drupal_set_title(t('Solicitar Invitación'));
    }
}
예제 #17
0
/**
 * Implements hook_html_head_alter().
 *
 * Disable zooming on mobile devices only on map pages. Zooming in makes the
 * map pages look terrible and presents a usability problem.
 */
function outreach_html_head_alter(&$head_elements)
{
    $path = current_path();
    // Map nids.
    if ($path == 'node/2117' || $path == 'node/2116' || $path == 'node/2115' || $path == 'ndoe/2114') {
        $head_elements['adaptivetheme_meta_viewport']['#attributes']['content'] = 'width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no';
    }
}
예제 #18
0
 /**
  * {@inheritdoc}
  */
 public function isFrontPage()
 {
     // Cache the result as this is called often.
     if (!isset($this->isCurrentFrontPage)) {
         $this->isCurrentFrontPage = current_path() == $this->getFrontPagePath();
     }
     return $this->isCurrentFrontPage;
 }
예제 #19
0
function cloudy_preprocess_menu_link(&$variables)
{
    if (!empty($variables['element']['#theme']) && $variables['element']['#theme'] == 'menu_link__menu_login_menu' && $variables['element']['#href'] == 'user/register') {
        $recruiter_urls = array('recruiter', 'recruiter/applications', 'recruiter/applications/all', 'recruiter/applications/shortlisted', 'recruiter/applications/rejected', 'manage/job', 'search/resume', 'profile-company');
        if (in_array(current_path(), $recruiter_urls)) {
            $variables['element']['#href'] = 'user/register/recruiter';
        }
    }
}
예제 #20
0
/**
 * Allows to override Colorbox settings and style.
 *
 * Implements hook_colorbox_settings_alter().
 *
 * @param array $settings
 *   An associative array of Colorbox settings. See the
 *   @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
 *   for the full list of supported parameters.
 * @param string $style
 *   The name of the active style plugin. If $style is 'none', no Colorbox
 *   theme will be loaded.
 */
function hook_colorbox_settings_alter(&$settings, &$style)
{
    // Disable automatic downscaling of images to maxWidth/maxHeight size.
    $settings['scalePhotos'] = FALSE;
    // Use custom style plugin specifically for node/123.
    if (current_path() == 'node/123') {
        $style = 'mystyle';
    }
}
예제 #21
0
/**
 * Preprocess html.tpl.php.
 *
 * @see bootstrap_material_js_alter()
 */
function bootstrap_material_preprocess_html(&$vars)
{
    // Add class to help us style admin pages.
    if (path_is_admin(current_path())) {
        $vars['classes_array'][] = 'admin';
    }
    // Prepare to initialize.
    drupal_add_js('(function ($){ $.material.init(); })(jQuery);', array('type' => 'inline', 'group' => JS_BOOTSTRAP_MATERIAL, 'scope' => 'footer', 'weight' => 2));
}
예제 #22
0
파일: Column.php 프로젝트: moiseh/metapages
 public function title()
 {
     // make sortable link
     if ($this->sortable) {
         $sortd = filter_input(INPUT_GET, 'sortd') == 'asc' ? 'desc' : 'asc';
         $args = array('sort' => $this->id, 'sortd' => $sortd);
         return anchor(current_path(), $this->label, $args);
     }
     return $this->label;
 }
예제 #23
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['grouptitle'] = array('#type' => 'textfield', '#title' => 'Layer group title', '#default_value' => $this->getOption('grouptitle', 'Base layers'));
     $all_layers = \Drupal\openlayers\Openlayers::loadAllExportable('Layer');
     array_walk($all_layers, function ($object) {
         $object->weight = 0;
         $object->enabled = 0;
     });
     foreach ($this->getOption('grouplayers', array()) as $weight => $layer) {
         $layer = Openlayers::load('layer', $layer);
         $all_layers[$layer->getMachineName()]->weight = $weight;
         $all_layers[$layer->getMachineName()]->enabled = 1;
     }
     uasort($all_layers, function ($a, $b) {
         if ($a->enabled > $b->enabled) {
             return -1;
         } else {
             if ($a->enabled < $b->enabled) {
                 return 1;
             }
         }
         if ($a->weight < $b->weight) {
             return -1;
         } else {
             if ($a->weight > $b->weight) {
                 return 1;
             }
         }
         if ($a->machine_name < $b->machine_name) {
             return -1;
         } else {
             if ($a->machine_name > $b->machine_name) {
                 return 1;
             }
         }
         return 0;
     });
     $data = array();
     $i = 0;
     /* @var \Drupal\openlayers\Types\Layer $layer */
     foreach ($all_layers as $machine_name => $layer) {
         $data[$machine_name] = array('name' => $layer->name, 'machine_name' => $layer->machine_name, 'factory_service' => $layer->factory_service, 'weight' => $i++, 'enabled' => isset($layer->enabled) ? $layer->enabled : 0);
     }
     $rows = array();
     $row_elements = array();
     foreach ($data as $id => $entry) {
         $rows[$id] = array('data' => array(array('class', array('entry-cross')), array('data' => array('#type' => 'weight', '#title' => t('Weight'), '#title_display' => 'invisible', '#default_value' => $entry['weight'], '#parents' => array('grouplayers', $id, 'weight'), '#attributes' => array('class' => array('entry-order-weight')))), array('data' => array('#type' => 'hidden', '#default_value' => $entry['machine_name'], '#parents' => array('grouplayers', $id, 'machine_name'))), array('data' => array('#type' => 'checkbox', '#title' => t('Enable'), '#title_display' => 'invisible', '#default_value' => $entry['enabled'], '#parents' => array('grouplayers', $id, 'enabled'))), check_plain($entry['name']), check_plain($entry['machine_name']), check_plain($entry['factory_service']), l(t('Edit'), 'admin/structure/openlayers/layers/list/' . $entry['machine_name'] . '/edit/options', array('query' => array('destination' => current_path())))), 'class' => array('draggable'));
         // Build rows of the form elements in the table.
         $row_elements[$id] = array('weight' => &$rows[$id]['data'][1]['data'], 'enabled' => &$rows[$id]['data'][2]['data'], 'machine_name' => &$rows[$id]['data'][3]['data']);
     }
     $form['grouplayers'] = array('#type' => 'fieldset', '#title' => 'Layers', '#collapsible' => FALSE, '#collapsed' => FALSE);
     // Add the table to the form.
     $form['grouplayers']['table_layers'] = array('#theme' => 'table', 'elements' => $row_elements, '#header' => array(array('data' => NULL, 'colspan' => 2), array('data' => t('Enabled'), 'colspan' => 2), t('Name'), t('Machine name'), t('Factory service'), t('Operations')), '#rows' => $rows, '#empty' => t('There are no entries available.'), '#attributes' => array('id' => 'entry-order-layers'));
     drupal_add_tabledrag('entry-order-layers', 'order', 'sibling', 'entry-order-weight');
 }
예제 #24
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     $build = array();
     $path = drupal_is_front_page() ? '<front>' : current_path();
     $type = $this->getDerivativeId();
     $links = $this->languageManager->getLanguageSwitchLinks($type, $path);
     if (isset($links->links)) {
         $build = array('#theme' => 'links__language_block', '#links' => $links->links, '#attributes' => array('class' => array("language-switcher-{$links->method_id}")), '#set_active_class' => TRUE);
     }
     return $build;
 }
예제 #25
0
 public static function checkAuth()
 {
     if (preg_match('/(builder\\/(.*)|^builder$)/', current_path())) {
         if (User::hasLoggedUser() && !User::logged()->isAdmin) {
             \Meta\Core\Flash::error(t('You need to login with user that have the "Admin user" flag to access the builder interface.'));
             User::logout();
         }
         if (!User::hasLoggedUser()) {
             redirect(url('user-login', array('back_to' => urlencode(current_path()))));
         }
     }
 }
예제 #26
0
파일: View.php 프로젝트: moiseh/metapages
 public function render()
 {
     // create button
     if ($this->showNavCreate) {
         $this->nav->addItem(new Navbar\Item(array('label' => t('Create new'), 'icon' => 'glyphicon-new-window', 'url' => url(current_path(), array('action' => 'add')))));
     }
     // load CSV helper
     if ($this->csvExport) {
         new \Meta\Builder\CsvExporter($this);
     }
     return parent::render();
 }
예제 #27
0
/**
 * Implements hook_css_alter().
 */
function omega_css_alter(&$css)
{
    $omega = drupal_get_path('theme', 'omega');
    // The CSS_SYSTEM aggregation group doesn't make any sense. Therefore, we are
    // pre-pending it to the CSS_DEFAULT group. This has the same effect as giving
    // it a separate (low-weighted) group but also allows it to be aggregated
    // together with the rest of the CSS.
    foreach ($css as &$item) {
        if ($item['group'] == CSS_SYSTEM) {
            $item['group'] = CSS_DEFAULT;
            $item['weight'] = $item['weight'] - 100;
        }
    }
    // Clean up core and contrib module CSS.
    $overrides = array('aggregator' => array('aggregator.css' => array('theme' => 'aggregator.theme.css'), 'aggregator-rtl.css' => array('theme' => 'aggregator.theme-rtl.css')), 'block' => array('block.css' => array('admin' => 'block.admin.css', 'demo' => 'block.demo.css')), 'book' => array('book.css' => array('theme' => 'book.theme.css', 'admin' => 'book.admin.css'), 'book-rtl.css' => array('theme' => 'book.theme-rtl.css')), 'color' => array('color.css' => array('admin' => 'color.admin.css'), 'color-rtl.css' => array('admin' => 'color.admin-rtl.css')), 'comment' => array('comment.css' => array('theme' => 'comment.theme.css'), 'comment-rtl.css' => array('theme' => 'comment.theme-rtl.css')), 'contextual' => array('contextual.css' => array('base' => 'contextual.base.css', 'theme' => 'contextual.theme.css'), 'contextual-rtl.css' => array('base' => 'contextual.base-rtl.css', 'theme' => 'contextual.theme-rtl.css')), 'field' => array('theme/field.css' => array('theme' => 'field.theme.css'), 'theme/field-rtl.css' => array('theme' => 'field.theme-rtl.css')), 'field_ui' => array('field_ui.css' => array('admin' => 'field_ui.admin.css'), 'field_ui-rtl.css' => array('admin' => 'field_ui.admin-rtl.css')), 'file' => array('file.css' => array('theme' => 'file.theme.css')), 'filter' => array('filter.css' => array('theme' => 'filter.theme.css')), 'forum' => array('forum.css' => array('theme' => 'forum.theme.css'), 'forum-rtl.css' => array('theme' => 'forum.theme-rtl.css')), 'image' => array('image.css' => array('theme' => 'image.theme.css'), 'image-rtl.css' => array('theme' => 'image.theme-rtl.css'), 'image.admin.css' => array('admin' => 'image.admin.css')), 'locale' => array('locale.css' => array('admin' => 'locale.admin.css'), 'locale-rtl.css' => array('admin' => 'locale.admin-rtl.css')), 'openid' => array('openid.css' => array('base' => 'openid.base.css', 'theme' => 'openid.theme.css'), 'openid-rtl.css' => array('base' => 'openid.base-rtl.css', 'theme' => 'openid.theme-rtl.css')), 'poll' => array('poll.css' => array('admin' => 'poll.admin.css', 'theme' => 'poll.theme.css'), 'poll-rtl.css' => array('theme' => 'poll.theme-rtl.css')), 'search' => array('search.css' => array('theme' => 'search.theme.css'), 'search-rtl.css' => array('theme' => 'search.theme-rtl.css')), 'system' => array('system.base.css' => array('base' => 'system.base.css'), 'system.base-rtl.css' => array('base' => 'system.base-rtl.css'), 'system.theme.css' => array('theme' => 'system.theme.css'), 'system.theme-rtl.css' => array('theme' => 'system.theme-rtl.css'), 'system.admin.css' => array('admin' => 'system.admin.css'), 'system.admin-rtl.css' => array('admin' => 'system.admin-rtl.css'), 'system.menus.css' => array('theme' => 'system.menus.theme.css'), 'system.menus-rtl.css' => array('theme' => 'system.menus.theme-rtl.css'), 'system.messages.css' => array('theme' => 'system.messages.theme.css'), 'system.messages-rtl.css' => array('theme' => 'system.messages.theme-rtl.css')), 'taxonomy' => array('taxonomy.css' => array('admin' => 'taxonomy.admin.css')), 'user' => array('user.css' => array('base' => 'user.base.css', 'admin' => 'user.admin.css', 'theme' => 'user.theme.css'), 'user-rtl.css' => array('admin' => 'user.admin-rtl.css', 'theme' => 'user.theme-rtl.css')));
    // Check if we are on an admin page. Otherwise, we can skip admin CSS.
    $path = current_path();
    $types = path_is_admin($path) ? array('base', 'theme', 'admin') : array('base', 'theme');
    // Add a special case for the block demo page.
    $types = strpos($path, 'admin/structure/block/demo') === 0 ? array_merge($types, array('demo')) : $types;
    // Override module provided CSS with clean and modern alternatives provided
    // by Omega.
    foreach ($overrides as $module => $files) {
        // We gathered the CSS files with paths relative to the providing module.
        $path = drupal_get_path('module', $module);
        foreach ($files as $file => $items) {
            if (isset($css[$path . '/' . $file])) {
                // Keep a copy of the original file array so we can merge that with our
                // overrides in order to keep the 'weight' and 'group' declarations.
                $original = $css[$path . '/' . $file];
                unset($css[$path . '/' . $file]);
                // Omega 4.x tries to follow the pattern described in
                // http://drupal.org/node/1089868 for declaring CSS files. Therefore, it
                // may take more than a single file to override a .css file added by
                // core. This gives us better granularity when overriding .css files
                // in a sub-theme.
                foreach ($types as $type) {
                    if (isset($items[$type])) {
                        $css[$omega . '/css/modules/' . $module . '/' . $items[$type]] = array('data' => $omega . '/css/modules/' . $module . '/' . $items[$type]) + $original;
                    }
                }
            }
        }
    }
    // Exclude CSS files as declared in the theme settings.
    if (omega_extension_enabled('assets') && ($regex = omega_theme_get_setting('omega_css_exclude_regex'))) {
        // Make sure that RTL styles are excluded as well when a file name has been
        // specified with it's full .css file extension.
        $regex = preg_replace('/\\\\.css$/', '(\\.css|-rtl\\.css)', $regex);
        omega_exclude_assets($css, $regex);
    }
}
예제 #28
0
파일: LinkEdit.php 프로젝트: moiseh/codegen
 public function format(array $row)
 {
     if (isset($row['id'])) {
         $url = url(current_path(), array('action' => 'edit', 'id' => $row['id']));
         $link = sprintf('<a href="%s"
                             class="btn btn-primary btn-xs">
                                 <span class="glyphicon glyphicon-edit"></span> %s
                          </a>', $url, t('edit'));
         //            $link = render('builder-link.php', array('url' => $url, 'label' => 'edit', 'icon' => 'glyphicon-edit', 'btn' => 'btn-info'));
         return $link;
     }
     return null;
 }
예제 #29
0
/**
 * Implements hook_preprocess_page().
 */
function shelter_preprocess_page(&$variables)
{
    // Put the language switcher in a variable.
    $block = module_invoke('locale', 'block_view', 'language_content');
    $variables['language_switcher'] = $block['content'];
    global $base_url;
    $variables['base_url'] = $base_url;
    $current_path = current_path();
    // Adding the viewport for mobile view.
    $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, minimal-ui'));
    drupal_add_html_head($viewport, 'viewport');
    libraries_load('underscore');
    drupal_add_library('system', 'jquery.cookie');
    $variables['hot_responses'] = FALSE;
    $variables['is_regions_and_countries'] = FALSE;
    $variables['is_user_profile_pages'] = FALSE;
    $variables['is_search_documents'] = FALSE;
    $variables['global_docs_search_page_link'] = l(t('Search all documents'), 'search-documents', array('attributes' => array('class' => array('search-documents-link')), 'query' => array('sort' => 'date', 'sort_direction' => 'DESC')));
    $variables['global_events_page'] = FALSE;
    $variables['recent_documents'] = FALSE;
    if ($variables['is_front']) {
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['upcoming_events'] = cluster_events_upcoming();
        $variables['recent_documents'] = cluster_docs_recent();
    }
    if ($current_path == 'regions-countries') {
        $variables['is_regions_and_countries'] = TRUE;
    }
    if ($current_path == 'search-documents') {
        $variables['is_search_documents'] = TRUE;
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['upcoming_events'] = NULL;
    }
    if ($current_path == 'events') {
        $variables['hot_responses'] = cluster_og_hot_responses();
        $variables['global_events_page'] = TRUE;
    }
    if (arg(0) == 'user') {
        $variables['is_user_profile_pages'] = TRUE;
    }
    $variables['extra'] = FALSE;
    if (isset($variables['page']['content']['system_main']['side-column'])) {
        $variables['extra'] = $variables['page']['content']['system_main']['side-column'];
        unset($variables['page']['content']['system_main']['side-column']);
    } elseif ($node = menu_get_object()) {
        if (isset($variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column'])) {
            $variables['extra'] = $variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column'];
            unset($variables['page']['content']['system_main']['nodes'][$node->nid][0]['side-column']);
        }
    }
}
예제 #30
0
 public function format(array $row)
 {
     if (isset($row['id'])) {
         $url = url(current_path(), array('action' => 'delete', 'id' => $row['id']));
         $link = sprintf('<a href="%s"
                             class="btn btn-danger btn-xs"
                             onclick="return confirm(\'Confirm this operation?\')">
                                 <span class="glyphicon glyphicon-trash"></span> %s
                          </a>', $url, t('delete'));
         //            $link = render('builder-link.php', array('url' => $url, 'label' => 'delete', 'icon' => 'glyphicon-trash', 'confirm' => $this->confirmation));
         return $link;
     }
     return null;
 }