function views_arg_load

cis7 views.module views_arg_load($value, $name, $display_id, $index)
cle7 views.module views_arg_load($value, $name, $display_id, $index)
elmsmedia7 views.module views_arg_load($value, $name, $display_id, $index)
icor7 views.module views_arg_load($value, $name, $display_id, $index)
meedjum_blog7 views.module views_arg_load($value, $name, $display_id, $index)
mooc7 views.module views_arg_load($value, $name, $display_id, $index)

Helper function for menu loading. This will automatically be called in order to 'load' a views argument; primarily it will be used to perform validation.

Parameters

$value: The actual value passed.

$name: The name of the view. This needs to be specified in the 'load function' of the menu entry.

$display_id: The display id that will be loaded for this menu item.

$index: The menu argument index. This counts from 1.

File

sites/all/modules/ulmus/views/views.module, line 470
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_arg_load($value, $name, $display_id, $index) {
  static $views = array();

  // Make sure we haven't already loaded this views argument for a similar menu
  // item elsewhere.
  $key = $name . ':' . $display_id . ':' . $value . ':' . $index;
  if (isset($views[$key])) {
    return $views[$key];
  }

  if ($view = views_get_view($name)) {
    $view->set_display($display_id);
    $view->init_handlers();

    $ids = array_keys($view->argument);

    $indexes = array();
    $path = explode('/', $view->get_path());

    foreach ($path as $id => $piece) {
      if ($piece == '%' && !empty($ids)) {
        $indexes[$id] = array_shift($ids);
      }
    }

    if (isset($indexes[$index])) {
      if (isset($view->argument[$indexes[$index]])) {
        $arg = $view->argument[$indexes[$index]]->validate_argument($value) ? $value : FALSE;
        $view->destroy();

        // Store the output in case we load this same menu item again.
        $views[$key] = $arg;
        return $arg;
      }
    }
    $view->destroy();
  }
}
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.