本文整理汇总了PHP中current_path函数的典型用法代码示例。如果您正苦于以下问题:PHP current_path函数的具体用法?PHP current_path怎么用?PHP current_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了current_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uconn_theme_preprocess_page
/**
* 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: aap_theme_breadcrumb
/**
* 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;
}
}
示例3: gettysw_preprocess_page
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: __construct
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: storyscopezen_field__field_fb_tags
/**
* 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: academy_delta_blocks_breadcrumb
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">»</span> ';
}
}
$output .= '</ul></div>';
}
return $output;
}
示例7: boostrapdrupal_textfield
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: sortLabel
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: ichado1_preprocess_page
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: bootstrap_filter_tips
/**
* 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: omega_css_alter
/**
* 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: floyd_process_page
/**
* @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: basetpl_process_page
/**
* 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: form
/**
* {@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: cignaglobal_preprocess_page
/**
* 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');
}