本文整理汇总了PHP中drupal_get_path_alias函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_get_path_alias函数的具体用法?PHP drupal_get_path_alias怎么用?PHP drupal_get_path_alias使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_get_path_alias函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_authorise_form
/**
* List of methods that assist with handling recording groups.
* @package Client
* @subpackage PrebuiltForms.
*/
function group_authorise_form($args, $readAuth)
{
if (!empty($args['limit_to_group_id']) && $args['limit_to_group_id'] !== (empty($_GET['group_id']) ? '' : $_GET['group_id'])) {
// page owned by a different group, so throw them out
hostsite_show_message(lang::get('This page is a private recording group page which you cannot access.'), 'alert');
hostsite_goto_page('<front>');
}
if (!empty($_GET['group_id'])) {
// loading data into a recording group. Are they a member or is the page public?
// @todo: consider performance - 2 web services hits required to check permissions.
if (hostsite_get_user_field('indicia_user_id')) {
$gu = data_entry_helper::get_population_data(array('table' => 'groups_user', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'user_id' => hostsite_get_user_field('indicia_user_id')), 'nocache' => true));
} else {
$gu = array();
}
$gp = data_entry_helper::get_population_data(array('table' => 'group_page', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'path' => drupal_get_path_alias($_GET['q']))));
if (count($gp) === 0) {
hostsite_show_message(lang::get('You are trying to access a page which is not available for this group.'), 'alert');
hostsite_goto_page('<front>');
} elseif (count($gu) === 0 && $gp[0]['administrator'] !== NULL) {
// not a group member, so throw them out
hostsite_show_message(lang::get('You are trying to access a page for a group you do not belong to.'), 'alert');
hostsite_goto_page('<front>');
}
}
}
示例2: rice_preprocess_page
/**
* Override or insert variables into the page template.
*/
function rice_preprocess_page(&$vars)
{
// CSS
drupal_add_css(drupal_get_path('theme', 'rice') . '/css/colors.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/css/columnal.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/css/custom.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/css/feed.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.carousel.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.transitions.css');
drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.theme.css');
drupal_add_css('https://fonts.googleapis.com/css?family=Cinzel');
// JS
drupal_add_js(drupal_get_path('theme', 'rice') . '/js/jquery-1.8.0.min.js');
drupal_add_js(drupal_get_path('theme', 'rice') . '/js/modernizr.js');
drupal_add_js(drupal_get_path('theme', 'rice') . '/js/moment-with-locales.js');
drupal_add_js(drupal_get_path('theme', 'rice') . '/js/tools.js');
drupal_add_js(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.carousel.js');
// Condition: Path
$match = "<front>";
$path = drupal_get_path_alias($_GET['q']);
$path_matches = drupal_match_path($path, $match);
if ($path != $_GET['q']) {
$path_matches = $path_matches || drupal_match_path($_GET['q'], $matches);
}
if ($path_matches) {
//drupal_add_css(drupal_get_path('theme', 'rice').'/css/style.css');
}
//Condition: Role
$role = 'anonymous user';
if (in_array($role, $vars['user']->roles)) {
//drupal_add_css(drupal_get_path('theme', 'rice').'/anonymous.css');
}
}
示例3: 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,
));
*/
}
示例4: stories_for_day
function stories_for_day($day)
{
global $s;
global $user;
$data = $s[1];
$today_events = array();
foreach ($data as $val) {
if ($val->field_date_value == $day) {
if (isset($today_events[$val->np_nid])) {
$today_events[$val->np_nid]['stories'][] = $val;
} else {
$today_events[$val->np_nid] = array('project_title' => $val->np_title, 'stories' => array($val));
}
}
}
$info = "";
foreach ($today_events as $project_nid => $cell_content) {
$info .= "<div class='monthly-schedule-project-item'><strong>" . l($cell_content['project_title'], drupal_get_path_alias("node/" . $project_nid)) . "</strong><ul>";
foreach ($cell_content['stories'] as $story) {
$info .= "<li ";
if ($story->name != $user->name) {
$info .= " class='not-assigned-to-me'";
}
$info .= ">" . l("#" . $story->nid, drupal_get_path_alias("node/" . $story->nid)) . " (" . $story->name . ")</li>";
}
$info .= "</ul></div>";
}
return $info;
}
示例5: getRouterItem
/**
* Returns a router item.
*
* This is a wrapper around menu_get_item() that sets additional keys
* (route, link_path, alias, fragments).
*
* @param $path
* The path for which the corresponding router item is returned.
* For example, node/5.
*
* @return array|null
* The router item.
*/
function getRouterItem($path)
{
$normalpath = drupal_get_normal_path($path);
try {
$item = menu_get_item($normalpath);
} catch (Exception $e) {
// Some modules throw an exception, if a path has unloadable arguments.
// We don't care, because we don't actually load this page.
return NULL;
}
// Some additional keys.
if (empty($item) || !is_array($item)) {
return NULL;
}
// 'route' is a less ambiguous name for a router path than 'path'.
$item['route'] = $item['path'];
// 'href' sounds more like it had already run through url().
$item['link_path'] = $normalpath;
$item['alias'] = drupal_get_path_alias($normalpath);
$item['fragments'] = explode('/', $normalpath);
if (!isset($item['localized_options'])) {
$item['localized_options'] = array();
}
if ('crumbs_special_menu_link_page' === $item['page_callback']) {
$item['href'] = '<nolink>';
}
if ($normalpath !== $item['href']) {
$pos = strlen($item['href']);
$item['variadic_suffix'] = substr($normalpath, $pos);
} else {
$item['variadic_suffix'] = NULL;
}
return $item;
}
示例6: 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;
}
}
示例7: eu_projects_theme_preprocess_page
/**
* Implements hook_preprocess_page().
*/
function eu_projects_theme_preprocess_page(&$vars, $hook)
{
$path_alias = drupal_get_path_alias();
// Webtools.
$inline_script = '<script defer src="//europa.eu/webtools/load.js" type="text/javascript"></script>';
$element = array('#type' => 'markup', '#markup' => $inline_script);
drupal_add_html_head($element, 'webtools');
// Apple-touch-icon-precomposed.
$apple_touch_icon_precomposed = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'apple-touch-icon-precomposed'));
drupal_add_html_head($apple_touch_icon_precomposed, 'apple-touch-icon-precomposed');
// Apple-touch-icon.
$apple_touch_icon = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'icon'));
drupal_add_html_head($apple_touch_icon, 'apple-touch-icon');
// Apple-mobile-web-app-capable.
$apple_mobile_web_app_capable = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes'));
drupal_add_html_head($apple_mobile_web_app_capable, 'apple-mobile-web-app-capable');
// Application-name.
$application_name = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => t('EU Results')));
drupal_add_html_head($application_name, 'application-name');
// Apple-mobile-web-app-title.
$apple_mobile_web_app_title = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-title', 'content' => t('EU Results')));
drupal_add_html_head($apple_mobile_web_app_title, 'apple-mobile-web-app-title');
// Apple-touch-startup-image-ec.
$apple_touch_startup_image_ec = array('#tag' => 'meta', '#attributes' => array('rel' => 'apple-touch-startup-image-ec', 'href' => file_create_url(path_to_theme() . '/images/startup-image.png')));
drupal_add_html_head($apple_touch_startup_image_ec, 'apple-touch-startup-image-ec');
// Preload geojson for map
if ($path_alias == 'search-projects') {
$path = explode('?', request_uri());
$var = isset($path[1]) ? '?' . $path[1] : '';
$preload_geojson = array('#tag' => 'link', '#attributes' => array('rel' => 'prefetch', 'href' => $GLOBALS['base_url'] . '/projects-geojson_' . $GLOBALS['language']->language . $var));
drupal_add_html_head($preload_geojson, 'preload_geojson');
}
}
示例8: THEMENAME_preprocess_html
/**
* Implements template_preprocess_html().
*
* Adds classes to <body> based on path.
*/
function THEMENAME_preprocess_html(&$vars)
{
// Get the current path and break it into sections.
$parts = explode('/', drupal_get_path_alias());
// Add classes to body based on first section of path.
switch ($parts[0]) {
case 'path_foo':
$vars['classes_array'][] = 'section-foo';
break;
case 'path_bar':
case 'path_baz':
$vars['classes_array'][] = 'section-bar';
break;
default:
$vars['classes_array'][] = 'section-baz';
break;
}
// Add classes based on combined first and second section.
if (count($parts) >= 2) {
switch ($parts[0] . '-' . $parts[1]) {
case 'path_foo-list':
case 'path_baz-list':
$vars['classes_array'][] = 'list-page';
break;
}
}
}
示例9: getUrlAlias
/**
* Custom callback to get the URL alias from an article.
*
* @param DataInterpreterInterface $interpreter
* The data interpreter for the current article entity.
*
* @return string
* The URL alias for the article.
*/
public function getUrlAlias(DataInterpreterInterface $interpreter)
{
/** @var \EntityDrupalWrapper $wrapper */
$wrapper = $interpreter->getWrapper();
$path = sprintf('node/%d', $wrapper->getIdentifier());
return drupal_get_path_alias($path);
}
示例10: boron_preprocess_page
function boron_preprocess_page(&$vars, $hook)
{
$body_classes = array($vars['body_classes']);
if (!$vars['is_front']) {
// Add unique classes for each page and website section
$path = drupal_get_path_alias($_GET['q']);
list($section, ) = explode('/', $path, 2);
list(, $subsection) = explode('/', $path, 3);
$body_classes[] = boron_id_safe('page-' . $path);
$body_classes[] = boron_id_safe('section-' . $section);
$body_classes[] = boron_id_safe('subsection-' . $subsection);
if (arg(0) == 'node') {
if (arg(1) == 'add') {
if ($section == 'node') {
array_pop($body_classes);
// Remove 'section-node'
}
$body_classes[] = 'section-node-add';
// Add 'section-node-add'
} elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
if ($section == 'node') {
array_pop($body_classes);
// Remove 'section-node'
}
$body_classes[] = 'section-node-' . arg(2);
// Add 'section-node-edit' or 'section-node-delete'
}
}
}
$vars['body_classes'] = implode(' ', $body_classes);
// Concatenate with spaces
}
示例11: boldy_preprocess_page
/**
* Override or insert PHPTemplate variables into the templates.
*/
function boldy_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
// Classes for body element. Allows advanced theming based on context
// (home page, node of certain type, etc.)
$classes = explode(' ', $vars['body_classes']);
// Remove the mostly useless page-ARG0 class.
if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-' . drupal_strtolower(arg(0))), $classes)) {
unset($classes[$index]);
}
if (!$vars['is_front']) {
// Add unique class for each page.
$path = drupal_get_path_alias($_GET['q']);
$classes[] = boldy_id_safe('page-' . $path);
// Add unique class for each website section.
list($section, ) = explode('/', $path, 2);
if (arg(0) == 'node') {
if (arg(1) == 'add') {
$section = 'node-add';
} elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
$section = 'node-' . arg(2);
}
}
$classes[] = boldy_id_safe('section-' . $section);
}
$vars['body_classes_array'] = $classes;
$vars['body_classes'] = implode(' ', $classes);
// Concatenate with spaces.
}
示例12: phptemplate_preprocess_page
function phptemplate_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
if ($alias != $_GET['q']) {
$suggestions = array();
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$suggestions[] = $template_filename;
}
$vars['template_files'] = array_merge((array) $suggestions, $vars['template_files']);
}
}
//todo i think this can be deleted
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$termid = arg(2);
$parent_term = taxonomy_get_parents($termid);
if (key($parent_term) == EMAILS_TERM_ID) {
$term = taxonomy_get_term($termid);
$vars['template_file'] = 'page-taxonomy-term-emails';
}
}
}
示例13: sca_responsive_sort_repertoire
function sca_responsive_sort_repertoire($results)
{
// dpm($results);
$sorted = array('remarks' => array());
$x = 0;
$doubled_entries = array(2425 => 2425, 2427 => 2427);
foreach ($results as $entry) {
// Views'as kažkodėl dubliuoja visus rezultatus, neturėjau laiko aiškintis kodėl, tad tiesiog atfiltruoju kas antrą.
if ($x % 2 !== 0 || in_array($entry->nid, $doubled_entries)) {
// $x++;
// continue;
}
// O kai kurie rezultatai (filmų rinkiniai), kažkodėl atrenkami po 4 kartus...
if (in_array($entry->node_field_data_field_filmas_nid, $doubled_entries)) {
// unset($doubled_entries[$entry->node_field_data_field_filmas_nid]);
// $x++;
// continue;
}
$x++;
$director = !empty($entry->field_field_motrezisierius) ? $entry->field_field_motrezisierius[0]['rendered']['#markup'] : '';
$director .= !empty($entry->field_field_vyrrezisierius) ? $entry->field_field_vyrrezisierius[0]['rendered']['#markup'] : '';
$director .= !empty($entry->field_field_daugrezisieriu) ? $entry->field_field_daugrezisieriu[0]['rendered']['#markup'] : '';
$sorted[$entry->taxonomy_term_data_field_data_field_vieta_tid][] = array('nid' => $entry->node_field_data_field_filmas_nid, 'entry_nid' => $entry->nid, 'alias' => drupal_get_path_alias('node/' . $entry->node_field_data_field_filmas_nid), 'time' => $entry->field_field_data[0]['rendered']['#markup'], 'small_date' => format_date(strtotime($entry->field_field_data_1[0]['raw']['value']), 'kalendoriaus'), 'title' => $entry->field_title_field[0]['rendered']['#markup'], 'title_lt' => $entry->node_field_data_field_filmas_title, 'title_en' => isset($entry->field_field_engpav[0]) ? $entry->field_field_engpav[0]['rendered']['#markup'] : NULL, 'year' => isset($entry->field_field_metaiirtrukme[0]) ? $entry->field_field_metaiirtrukme[0]['rendered']['#markup'] : NULL, 'country' => !empty($entry->field_field_salis) ? $entry->field_field_salis[0]['rendered']['#markup'] : NULL, 'director' => $director, 'color' => !empty($entry->field_field_programos_spalva) ? $entry->field_field_programos_spalva[0]['rendered']['#markup'] : 'fff', 'extra_text' => !empty($entry->field_field_extra_text) ? $entry->field_field_extra_text[0]['rendered']['#markup'] : NULL, 'program_name' => !empty($entry->field_name_field) ? $entry->field_name_field[0]['rendered']['#markup'] : '', 'remarks' => !empty($entry->field_field_rep_iraso_pastabos) ? $entry->field_field_rep_iraso_pastabos[0]['rendered']['#markup'] : '');
if (!empty($entry->field_field_rep_iraso_pastabos)) {
$sorted['remarks'][] = array('time' => $entry->field_field_data_2[0]['rendered']['#markup'], 'place' => $entry->field_field_pilnas_pavadinimas[0]['rendered']['#markup'], 'remark' => $entry->field_field_rep_iraso_pastabos[0]['rendered']['#markup']);
}
}
// dpm($sorted);
return $sorted;
}
示例14: openfit_base_preprocess_comment
function openfit_base_preprocess_comment(&$variables)
{
$openfit_node_types = array('activity' => TRUE);
if (!isset($variables['node']) || !isset($openfit_node_types[$variables['node']->type])) {
return;
}
$comment = $variables['comment'];
// Remove the standard comment links: reply, edit, delete
unset($variables['content']['links']['comment']['#links']);
// Add a delete menu if the user posted the comment or is admin
global $user;
if (user_access('administer comments') || $user->uid == $comment->uid) {
$url = drupal_get_path_alias('node/' . $variables['node']->nid) . '/comments';
$variables['content']['links']['comment']['#links'] = array('comment-delete' => array('title' => ' ', 'href' => 'comment/' . $comment->cid . '/delete', 'query' => array('destination' => $url), 'html' => TRUE));
}
// Display "XX ago" for posts less than 1 day, otherwise use locale to format datetime
$ago = time() - $comment->created;
if ($ago < 86400) {
$variables['created'] = t('!interval ago', array('!interval' => format_interval(time() - $comment->created)));
} else {
$locale = OpenFitUserSetting::getCurrentUserLocale();
$fmt = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
$created = new DateTime('now');
$created->setTimestamp($comment->created);
$variables['created'] = $fmt->format($created);
}
$variables['submitted'] = $variables['author'] . ' ' . '<time datetime="' . $variables['datetime'] . '" pubdate="pubdate">' . $variables['created'] . '</time>';
}
示例15: msd15_preprocess_page
/**
* Preprocessor for page.tpl.php template file.
*/
function msd15_preprocess_page(&$vars, $hook)
{
// Get the entire main menu tree
$main_menu_tree = menu_tree_all_data('main-menu');
$vars['menu_tree_all_data'] = $main_menu_tree;
// Add the rendered output to the $main_menu_expanded variable
$vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
if (isset($vars['node']->type)) {
// We don't want to apply this on taxonomy or view pages
// Splice (2) is based on existing default suggestions. Change it if you need to.
array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . $vars['node']->type);
// Get the url_alias and make each item part of an array
$url_alias = drupal_get_path_alias($_GET['q']);
$split_url = explode('/', $url_alias);
// Add the full path template pages
// Insert 2nd to last to allow page--node--[nid] to be last
$cumulative_path = '';
foreach ($split_url as $path) {
$cumulative_path .= '__' . $path;
$path_name = 'page' . $cumulative_path;
array_splice($vars['theme_hook_suggestions'], -1, 0, str_replace('-', '_', $path_name));
}
// This does just the page name on its own & is considered more specific than the longest path
// (because sometimes those get too long)
// Also we don't want to do this if there were no paths on the URL
// Again, add 2nd to last to preserve page--node--[nid] if we do add it in
if (count($split_url) > 1) {
$page_name = end($split_url);
array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . str_replace('-', '_', $page_name));
}
}
}