arg

Versions
4.6 – 5
arg($index)
6 – 7
arg($index = NULL, $path = NULL)

Return a component of the current Drupal path.

When viewing a page at the path "admin/node/configure", for example, arg(0) would return "admin", arg(1) would return "node", and arg(2) would return "configure".

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.

▾ 63 functions call arg()

aggregator_edit in modules/aggregator.module
aggregator_page_category in modules/aggregator.module
Menu callback; displays all the items aggregated in a particular category.
aggregator_page_last in modules/aggregator.module
Menu callback; displays the most recent items gathered from any feed.
aggregator_page_source in modules/aggregator.module
Menu callback; displays all the items captured from a particular feed.
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.
block_list in modules/block.module
Return all blocks in the specied region for the current user. You may
blogapi_blogapi in modules/blogapi.module
blog_link in modules/blog.module
Implementation of hook_link().
book_block in modules/book.module
Implementation of hook_block().
book_content in modules/book.module
book_form in modules/book.module
Implementation of hook_form().
book_help in modules/book.module
Implementation of hook_help().
book_menu in modules/book.module
Implementation of hook_menu().
book_outline in modules/book.module
Implementation of function book_outline() Handles all book outline operations.
comment_menu in modules/comment.module
Implementation of hook_menu().
comment_node_url in modules/comment.module
contact_mail_user in modules/contact.module
contact_menu in modules/contact.module
Implementation of hook_menu().
filter_admin_configure in modules/filter.module
Menu callback; display settings defined by filters.
filter_admin_delete in modules/filter.module
Menu callback; confirm deletion of a format.
filter_admin_filters in modules/filter.module
Menu callback; configure the filters for a format.
filter_admin_filters_save in modules/filter.module
Save enabled/disabled status for filters in a format.
filter_admin_order in modules/filter.module
Menu callback; display form for ordering filters for a format.
filter_admin_order_save in modules/filter.module
Save the weights of filters in a format.
filter_help in modules/filter.module
Implementation of hook_help().
filter_menu in modules/filter.module
Implementation of hook_menu().
filter_tips_long in modules/filter.module
Menu callback; show a page with long filter tips.
forum_admin in modules/forum.module
Administration page which allows maintaining forums
forum_form in modules/forum.module
Implementation of hook_form().
help_page in modules/help.module
Menu callback; prints a page listing general help for all modules.
legacy_menu in modules/legacy.module
Implementation of hook_menu().
locale_admin_manage_delete_screen in modules/locale.module
User interface for the language deletion confirmation screen
locale_admin_string in modules/locale.module
Page handler for the string search and administration screen
node_admin in modules/node.module
Menu callback; presents the content administration overview.
node_help in modules/node.module
Implementation of hook_help().
node_menu in modules/node.module
Implementation of hook_menu().
node_page in modules/node.module
Menu callback; dispatches control to the appropriate operation handler.
poll_menu in modules/poll.module
Implementation of hook_menu().
poll_results in modules/poll.module
Callback for the 'results' tab for polls you can vote on
poll_view in modules/poll.module
Implementation of hook_view().
poll_vote in modules/poll.module
Callback for processing a vote
profile_browse in modules/profile.module
Menu callback; display a list of user information.
queue_block in modules/queue.module
Implementation of hook_block().
search_block in modules/search.module
Implementation of hook_block().
search_menu in modules/search.module
Implementation of hook_menu().
search_view in modules/search.module
Menu callback; presents the search form and/or search results.
statistics_exit in modules/statistics.module
Implementation of hook_exit().
statistics_menu in modules/statistics.module
Implementation of hook_menu().
statistics_node_tracker in modules/statistics.module
statistics_user_tracker in modules/statistics.module
system_help in modules/system.module
Implementation of hook_help().
taxonomy_admin in modules/taxonomy.module
Menu callback; dispatches to the proper taxonomy administration function.
taxonomy_form_term in modules/taxonomy.module
tracker_menu in modules/tracker.module
Implementation of hook_menu().
tracker_track_user in modules/tracker.module
Menu callback. Prints a listing of active nodes on the site.
user_admin in modules/user.module
user_admin_role in modules/user.module
Menu callback: administer roles.
user_block in modules/user.module
Implementation of hook_block().
user_configure in modules/user.module
user_edit in modules/user.module
user_menu in modules/user.module
Implementation of hook_menu().
user_page in modules/user.module
user_user in modules/user.module
Implementation of hook_user().

Code

includes/bootstrap.inc, line 527

<?php
function arg($index) {
  static $arguments, $q;

  if (empty($arguments) || $q != $_GET['q']) {
    $arguments = explode('/', $_GET['q']);
  }

  if (array_key_exists($index, $arguments)) {
    return $arguments[$index];
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.