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


PHP drupal_lookup_path函数代码示例

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


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

示例1: 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;
}
开发者ID:bridharr,项目名称:storyscope-lite,代码行数:38,代码来源:template.php

示例2: libya_cron_subscription_mail

function libya_cron_subscription_mail($data)
{
    // subscription node
    $mail = $data[0];
    $nids = $data[1];
    // watchdog('actions', 'Cron subscription vars', func_get_args());
    global $siteName, $isMail, $base_url;
    $isMail = TRUE;
    $body = '<h1 style="font-size:1.25em;">Your alert subscription results from ' . $siteName . '</h1>
	<p class="no-margin">The following results match your subscription alert.</p>';
    foreach ($nids as $nid) {
        $N = node_load($nid);
        $content = strip_tags($N->body['und'][0]['value']);
        if (strlen($content) > 200) {
            $content = substr($content, 0, 200);
        }
        $CL = strrpos($content, ' ');
        $content = substr($content, 0, $CL) . '...';
        $body .= '<h2 style="font-size:1.25em;">' . l($N->title, 'node/' . $N->nid, array('attributes' => array('style' => array('text-decoration' => 'none')))) . '</h2><p>' . $content . '</p>
		<p>' . t('read more: ') . l($base_url . '/' . drupal_lookup_path('alias', 'node/' . $N->nid), 'node/' . $N->nid, array('absolute' => TRUE)) . '</p>
		<hr/>';
    }
    $data['message'] = 'Mail sent';
    $to = $mail['mail'];
    $from = variable_get('site_mail', 'mail@libyanwarthetruth.com');
    $params = array('body' => $body, 'rand' => $mail['rand'], 'to' => $to);
    $sent = drupal_mail('libya', 'subscription_alert_mail', $to, language_default(), $params, $from, TRUE);
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:28,代码来源:cron.php

示例3: unl_fourone_og_menu_breadcrumb_alter

/**
 * Implements hook_menu_breadcrumb_alter().
 */
function unl_fourone_og_menu_breadcrumb_alter(&$active_trail, $item)
{
    $group = unl_fourone_og_get_current_group();
    if ($group) {
        $front_nid = unl_fourone_og_get_front_group_id();
        // Only splice in the current group if the current group is not the main/front group.
        if ($group->nid !== $front_nid) {
            $group_breadcrumb = array('title' => $group->title, 'href' => 'node/' . $group->nid, 'link_path' => '', 'localized_options' => array(), 'type' => 0);
        }
    } else {
        // No group was found, use the default breadcrumbs.
        $base_path = theme_get_setting('unl_fourone_og_base_path', 'unl_fourone_og');
        $title = '';
        // Get the title and path to use.
        if (empty($base_path)) {
            $title = variable_get('site_name', 'Unknown Site name');
        } else {
            $path = drupal_lookup_path("source", $base_path);
            $node = menu_get_object("node", 1, $path);
            $title = $node->title;
        }
        $group_breadcrumb = array('title' => $title, 'href' => $base_path, 'link_path' => '', 'localized_options' => array(), 'type' => 0);
    }
    if (isset($group_breadcrumb)) {
        array_splice($active_trail, 1, 0, array($group_breadcrumb));
    }
}
开发者ID:unlcms,项目名称:unl_fourone_og,代码行数:30,代码来源:template.php

示例4: moretour_corolla_preprocess

function moretour_corolla_preprocess(&$variables, $hook)
{
    if ($hook != 'page' && $hook != 'html') {
        return;
    }
    if ($variables['is_front']) {
        $path = variable_get('site_frontpage');
        $path_alias = drupal_lookup_path('alias', $path);
        if ($path_alias) {
            $path = $path_alias;
        }
    } else {
        $path = request_path();
    }
    if (preg_match('#^(\\d{4})(/.*)?#', $path, $matches)) {
        $year = $matches[1];
        // Append year to the site name/title.
        if ($hook == 'page') {
            $variables['site_name'] .= " {$year}";
        } else {
            $variables['head_title'] .= " {$year}";
        }
        // Use 2013 specific logo
        if (!empty($variables['site_logo'])) {
            $variables['site_logo'] = str_replace('NOYEAR', $year, $variables['site_logo']);
        }
    }
}
开发者ID:hansfn,项目名称:moretour,代码行数:28,代码来源:template.php

示例5: famelab_menu_item

function famelab_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL)
{
    $class = $menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf');
    if (!empty($extra_class)) {
        $class .= ' ' . $extra_class;
    }
    if ($in_active_trail) {
        $class .= ' active-trail';
    } else {
        // Get the link's URL (sadly, this function doesn't include the link object)
        $url_pattern = '/<a\\s[^>]*href=\\"([^\\"]*)\\"[^>]*>.*<\\/a>/siU';
        preg_match($url_pattern, $link, $matches);
        $link_path = substr_replace($matches[1], '', 0, 1);
        // remove first slash
        $contexts = context_get();
        if (!empty($contexts)) {
            $active_paths = array();
            foreach ($contexts['context'] as $context) {
                if (array_key_exists('menu', $context->reactions)) {
                    $active_paths[$context->reactions['menu']] = $context->reactions['menu'];
                }
            }
            if (in_array(drupal_lookup_path('source', $link_path), $active_paths)) {
                $class .= ' active-trail';
            }
        }
    }
    return '<li class="' . $class . '">' . $link . $menu . "</li>\n";
}
开发者ID:nodefortytwo,项目名称:famelab,代码行数:29,代码来源:template.php

示例6: getPathAlias

 /**
  * 
  */
 function getPathAlias($nid)
 {
     $alias = $nid;
     // Check for an alias using drupal_lookup_path()
     if (drupal_lookup_path('alias', 'node/' . $nid) !== false) {
         $alias = drupal_lookup_path('alias', 'node/' . $nid);
     }
     return $alias;
 }
开发者ID:nayanseth,项目名称:meetups,代码行数:12,代码来源:Model.php

示例7: mybasictheme_preprocess_node

function mybasictheme_preprocess_node(&$variables)
{
    // Check whether we have some comments present
    if (isset($variables['comment_count'])) {
        if ($variables['comment_count'] > 0) {
            // Add a new custom $commentlink variable
            $variables['commentlink'] = l(format_plural($variables['comment_count'], '1 comment', '@count comments'), drupal_lookup_path('alias', 'node/' . $variables['nid']), array('fragment' => 'comments'));
        }
    }
    // Re-write the $submitted variable the way we want it
    $variables['submitted'] = t('@datetime | by !username', array('!username' => $variables['name'], '@datetime' => date("j F Y", $variables['created'])));
}
开发者ID:adamstacey5,项目名称:drupal-7-training,代码行数:12,代码来源:template.php

示例8: hotel_preprocess_html

function hotel_preprocess_html(&$vars)
{
    $node_id = drupal_lookup_path('source', 'page-404');
    if (!empty($node_id)) {
        $parts = explode("/", $node_id);
        $n_id = false;
        if (count($parts) > 1) {
            $n_id = $parts[1];
        }
        if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) {
            $vars['classes_array'][] = 'page-404-body';
        }
    }
}
开发者ID:AVE303,项目名称:janenjoost,代码行数:14,代码来源:template.php

示例9: getNodeFromUrl

 /**
  * Returns node currently being viewed. Assumes /node/[nid] URL.
  *
  * Using path-based loaders, like menu_load_object(), will not work.
  *
  * @return object
  *   The currently viewed node.
  *
  * @throws Exceptionq
  */
 public function getNodeFromUrl()
 {
     $path = $this->getCurrentPath();
     $system_path = drupal_lookup_path('source', $path);
     if (!$system_path) {
         $system_path = $path;
     }
     $menu_item = menu_get_item($system_path);
     if ($menu_item['path'] == 'node/%') {
         $node = node_load($menu_item['original_map'][1]);
     } else {
         throw \Exception(sprintf("Node could not be loaded from URL '%s'", $path));
     }
     return $node;
 }
开发者ID:theneonlobster,项目名称:eedplatek,代码行数:25,代码来源:FeatureContext.php

示例10: klipfolio_theme_preprocess_page

/**
 * Preprocess variables for page.tpl.php
 *
 * @see page.tpl.php
 */
function klipfolio_theme_preprocess_page(&$vars)
{
    $node = "";
    if (isset($vars['node'])) {
        $node = $vars['node'];
    } elseif (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) !== 'edit') {
        $node = node_load(arg(1));
    }
    $type = "";
    if ($node && isset($node->type)) {
        $type = $node->type;
    }
    $vars['node_type'] = $type;
    $vars['current_page'] = drupal_lookup_path("alias", current_path());
}
开发者ID:akhattab-klipfolio,项目名称:Drupal-Git,代码行数:20,代码来源:template.php

示例11: hotel_preprocess_html

function hotel_preprocess_html(&$vars)
{
    $node_id = drupal_lookup_path('source', 'page-404');
    if (!empty($node_id)) {
        $parts = explode("/", $node_id);
        $n_id = false;
        if (count($parts) > 1) {
            $n_id = $parts[1];
        }
        if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) {
            $vars['classes_array'][] = 'page-404-body';
        }
    }
    /* Add custom fonts */
    drupal_add_css('http://fonts.googleapis.com/css?family=Oswald:400,300', array('type' => 'external'));
}
开发者ID:andrygorokhovets,项目名称:hotel_theme,代码行数:16,代码来源:template.php

示例12: forum_plus_preprocess_html

function forum_plus_preprocess_html(&$vars)
{
    $node_id = drupal_lookup_path('source', '404-page');
    if (!empty($node_id)) {
        $parts = explode("/", $node_id);
        $n_id = false;
        if (count($parts) > 1) {
            $n_id = $parts[1];
        }
        if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) {
            $vars['theme_hook_suggestions'][] = 'html__404';
        }
    }
    if (count($vars['theme_hook_suggestions']) == 1) {
        if (isset($vars['page']['content']['system_main']['main']['#markup']) && trim($vars['page']['content']['system_main']['main']['#markup']) == t('The requested page "@path" could not be found.', array('@path' => request_uri()))) {
            $vars['theme_hook_suggestions'][] = 'html__404';
        }
    }
}
开发者ID:TechBK,项目名称:noname,代码行数:19,代码来源:template.php

示例13: parseTags

 protected function parseTags(array $tags, $attribute_name)
 {
     $result = array();
     foreach ($tags as $tag) {
         if (isset($tag[$attribute_name])) {
             $original = (string) $tag[$attribute_name];
             // Lookup the system path if we're dealing with an alias.
             $source_path = drupal_lookup_path('source', $original);
             $alias = false;
             if ($source_path) {
                 $original = $source_path;
                 $alias = true;
             }
             $entities = $this->entitiesFromUrl($original, $alias);
             $result[(string) $tag[$attribute_name]] = $entities;
         }
     }
     return $result;
 }
开发者ID:sammarks,项目名称:publisher,代码行数:19,代码来源:TextAreaLinkReferenceHandler.php

示例14: main_preprocess_entity

function main_preprocess_entity(&$variables)
{
    if ($variables['elements']['#bundle'] == "project_image") {
        $current_path = substr($_SERVER['REQUEST_URI'], 1);
        $entity_id = $variables['elements']['#entity']->id;
        $current_delta = 0;
        $next_delta = 0;
        $path_arguments = explode('/', $current_path);
        // Check if 3 arguments are there
        if (count($path_arguments) == 3) {
            $node_alias = $path_arguments[0] . "/" . $path_arguments[1];
            // Create node path out of the first two arguments to see if it's a node
            if ($node_path = drupal_lookup_path('source', $node_alias)) {
                $node = menu_get_object("node", 1, $node_path);
                // Check if node is of the right type
                if ($node->type == "project") {
                    // Check if third argument is a number
                    if (is_numeric($path_arguments[2])) {
                        // Load images field
                        $images = field_get_items('node', $node, 'field_project_images');
                        foreach ($images as $delta => $image) {
                            if ($image['target_id'] == $entity_id) {
                                $current_delta = $delta;
                                break;
                            }
                        }
                        // Check if the next delta is valid
                        // if not, redirect to 1
                        if (array_key_exists($current_delta + 1, $images)) {
                            $next_delta = $current_delta + 1;
                        } else {
                            $next_delta = 0;
                        }
                        $variables['next_link'] = '/' . $node_alias . '/' . ($next_delta + 1);
                    }
                }
            }
        }
    }
}
开发者ID:EncoreMultimedia,项目名称:Projects,代码行数:40,代码来源:template.php

示例15: entitiesFromPath

 /**
  * Entities from Path
  *
  * Given a system path with entity references (node IDs, etc), returns the router url
  * and an array of entities represented in that path.
  *
  * @param string $path The path to break apart.
  *
  * @return array The router_url and an array of entities represented in the path.
  */
 public static function entitiesFromPath($path)
 {
     if ($source = drupal_lookup_path('source', $path)) {
         $path = $source;
     }
     $entities = array('router_url' => '', 'entities' => array());
     if ($router_item = self::getRouterItem($path)) {
         if (is_array($router_item) && array_key_exists('page_arguments', $router_item) && is_array($router_item['page_arguments'])) {
             $entities['router_url'] = $router_item['path'];
             foreach ($router_item['page_arguments'] as $drupal_entity) {
                 $entity = Entity::convert($drupal_entity);
                 if ($entity) {
                     $entities['entities'][] = $entity;
                 }
             }
         }
     }
     // If nothing came of that, we'll leave the URL be.
     if (!$entities['router_url']) {
         $entities['router_url'] = $path;
     }
     return $entities;
 }
开发者ID:sammarks,项目名称:publisher,代码行数:33,代码来源:EntityPathHelper.php


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