function arg

cis7 bootstrap.inc arg($index = NULL, $path = NULL)
cle7 bootstrap.inc arg($index = NULL, $path = NULL)
elmsmedia7 bootstrap.inc arg($index = NULL, $path = NULL)
icor7 bootstrap.inc arg($index = NULL, $path = NULL)
meedjum_blog7 bootstrap.inc arg($index = NULL, $path = NULL)
mooc7 bootstrap.inc arg($index = NULL, $path = NULL)

Returns a component of the current Drupal path.

When viewing a page at the path "admin/structure/types", for example, arg(0) returns "admin", arg(1) returns "structure", and arg(2) returns "types".

Avoid use of this function where possible, as resulting code is hard to read. In menu callback functions, attempt to use named arguments. See the explanation in menu.inc for how to construct callbacks that take arguments. When attempting to use this function to load an element from the current path, e.g. loading the node on a node page, use menu_get_object() instead.

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).

$path: A path to break into components. Defaults to the path of the current page.

Return value

The component specified by $index, or NULL if the specified component was not found. If called without arguments, it returns an array containing all the components of the current path.

119 calls to arg()
adaptivetheme_breadcrumb in sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
Returns HTML for a breadcrumb trail.
adaptivetheme_preprocess_page in sites/all/themes/ulmus/adaptivetheme/at_core/inc/preprocess.inc
Preprocess variables for page.tpl.php
addanother_access in sites/all/modules/ulmus/addanother/addanother.module
Check if we should display the Add another verbage on a node.
admin_theme_admin_theme_check in sites/all/modules/ulmus/admin_theme/admin_theme.module
Implementation of hook_admin_theme_check().
advagg_missing_generate in sites/all/modules/ulmus/advagg/advagg.missing.inc
Generates a missing CSS/JS file and send it to client.

... See full list

2 string references to 'arg'
token_tokens in sites/all/modules/ulmus/token/token.tokens.inc
Implements hook_tokens().
uuid_menu in sites/all/modules/ulmus/uuid/uuid.module
Implements hook_menu().

File

includes/bootstrap.inc, line 2852
Functions that need to be loaded on every Drupal request.

Code

function arg($index = NULL, $path = NULL) {
  // Even though $arguments doesn't need to be resettable for any functional
  // reasons (the result of explode() does not depend on any run-time
  // information), it should be resettable anyway in case a module needs to
  // free up the memory used by it.
  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['arguments'] = &drupal_static(__FUNCTION__);
  }
  $arguments = &$drupal_static_fast['arguments'];

  if (!isset($path)) {
    $path = $_GET['q'];
  }
  if (!isset($arguments[$path])) {
    $arguments[$path] = explode('/', $path);
  }
  if (!isset($index)) {
    return $arguments[$path];
  }
  if (isset($arguments[$path][$index])) {
    return $arguments[$path][$index];
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.