You are here

function subscriptions_arg in Subscriptions 7

Same name and namespace in other branches
  1. 6 subscriptions.module \subscriptions_arg()
  2. 2.0.x subscriptions.module.old.php \subscriptions_arg()

Returns arg($index) in the proper way.

Parameters

int $index:

bool $member_name:

Return value

mixed

9 calls to subscriptions_arg()
subscriptions_form_user_profile_form_alter in ./subscriptions.module
Implements hook_form_alter().
subscriptions_init in ./subscriptions.module
Implements hook_init().
subscriptions_page_form in ./subscriptions.admin.inc
Display subscribed content data on the user and site subscriptions pages. @ TODO clean up all of these parts
subscriptions_page_form_submit in ./subscriptions.admin.inc
Subscriptions page submit handler.
subscriptions_ui_block_view in ./subscriptions_ui.module
Implements hook_block_view().

... See full list

File

./subscriptions.module, line 1063
Subscriptions module.

Code

function subscriptions_arg($index, $member_name = FALSE) {
  if (($mgi = menu_get_item()) && isset($mgi['map'][$index])) {
    $path_exploded = $mgi['map'];
  }
  else {
    $path_exploded = explode('/', current_path());
  }
  $arg = NULL;
  if (!empty($path_exploded[$index])) {
    $arg = $path_exploded[$index];
    if ($member_name) {
      if (is_object($arg) && isset($arg->{$member_name})) {
        $arg = $arg->{$member_name};
      }
      else {
        $arg = NULL;
      }
    }
  }
  return $arg;
}