Package base :: Package includes :: Module path
[hide private]

Module path

source code

Functions to handle paths in Drupy, including path aliasing.
See Also:
Drupy Homepage, Drupal Homepage
Notes:

Author: Brendon Crawford

Copyright: 2008 Brendon Crawford

Contact: message144 at users dot sourceforge dot net

Version: 0.1

Functions [hide private]
 
drupal_init_path()
Initialize the php.GET['q'] variable to the proper normal path.
source code
 
drupal_lookup_path(action, path_='', path_language='')
Given an alias, return its Drupal system URL if one exists.
source code
 
drupal_get_path_alias(path, path_language='')
Given an internal Drupal path, return the alias set by the administrator.
source code
 
drupal_get_normal_path(path, path_language='')
Given a path alias, return the internal path it represents.
source code
 
arg(index=None, path=None)
Return a component of the current Drupal path.
source code
 
drupal_get_title()
Get the title of the current page, for display on the page and in the title bar.
source code
 
drupal_set_title(title=None)
Set the title of the current page, for display on the page and in the title bar.
source code
 
drupal_is_front_page()
Check if the current page is the front page.
source code
 
drupal_match_path(path_, patterns)
Check if a path matches any pattern in a set of patterns.
source code
Variables [hide private]
  __version__ = '$Revision: 1 $'
Function Details [hide private]

drupal_lookup_path(action, path_='', path_language='')

source code 
Given an alias, return its Drupal system URL if one exists. Given a Drupal system URL return one of its aliases if such a one exists. Otherwise, return FALSE.
Parameters:
  • action - One of the following values: - wipe: delete the alias cache. - alias: return an alias for a given Drupal system path (if one exists). - source: return the Drupal system URL for a path alias (if one exists).
  • path - The path to investigate for corresponding aliases or system URLs.
  • path_language - Optional language code to search the path with. Defaults to the page language. If there's no path defined for that language it will search paths without language.
Returns:
Either a Drupal system path, an aliased path, or FALSE if no path was found.

drupal_get_path_alias(path, path_language='')

source code 
Given an internal Drupal path, return the alias set by the administrator.
Parameters:
  • path - An internal Drupal path.
  • path_language - An optional language code to look up the path in.
Returns:
An aliased path if one was found, or the original path if no alias was found.

drupal_get_normal_path(path, path_language='')

source code 
Given a path alias, return the internal path it represents.
Parameters:
  • path - A Drupal path alias.
  • path_language - An optional language code to look up the path in.
Returns:
The internal path represented by the alias, or the original alias if no internal path was found.

arg(index=None, path=None)

source code 
Return a component of the current Drupal path. When viewing a page at the path "admin/build/types", for example, arg(0) would return "admin", arg(1) would return "content", and arg(2) would return "types". Avoid use of this function where possible, as resulting code is hard to read. Instead, attempt to use named arguments in menu callback functions. See the explanation in menu.inc for how to construct callbacks that take arguments.
Parameters:
  • index - The index of the component, where each component is separated by a '/' (forward-slash), and where the first component has an index of 0 (zero).
Returns:
The component specified by index, or NULL if the specified component was not found.

drupal_get_title()

source code 
Get the title of the current page, for display on the page and in the title bar.
Returns:
The current page's title.

drupal_set_title(title=None)

source code 
Set the title of the current page, for display on the page and in the title bar.
Parameters:
  • title - Optional string value to assign to the page title; or if set to NULL (default), leaves the current title unchanged.
Returns:
The updated title of the current page.

drupal_is_front_page()

source code 
Check if the current page is the front page.
Returns:
Boolean value: TRUE if the current page is the front page; FALSE if otherwise.

drupal_match_path(path_, patterns)

source code 
Check if a path matches any pattern in a set of patterns.
Parameters:
  • path - The path to match.
  • patterns - String containing a set of patterns separated by , or .
Returns:
Boolean value: TRUE if the path matches a pattern, FALSE otherwise.

Note: DRUPY: This function was substantially modified