You are here

function _views_get_arguments in Views (for Drupal 7) 5

Return the arguments array; construct one if we haven't already. The array is cached in a global, safely named variable so that arguments are only constructed once per run.

7 calls to _views_get_arguments()
views_edit_view in ./views_ui.module
Display all the guts of a view in a form for editing.
views_get_summary_link in ./views.module
Get the summary link for a view.
views_get_title in ./views.module
Figure out what the title of a view should be.
views_ui_add_argument in ./views_ui.module
Add all the info for a single argument into the form.
_views_build_summary in ./views_query.inc

... See full list

File

./views_cache.inc, line 24

Code

function _views_get_arguments($titles = false) {
  static $views_arguments;
  global $locale;
  if (!$views_arguments) {
    $data = cache_get("views_arguments:{$locale}", 'cache_views');
    $cache = unserialize($data->data);
    if (is_array($cache)) {
      $views_arguments = $cache;
    }
    else {
      $arguments = module_invoke_all('views_arguments');

      // allow modules to alter the definitions supplied others
      foreach (module_implements('views_arguments_alter') as $module) {
        $function = $module . '_views_arguments_alter';
        $function($arguments);
      }
      uasort($arguments, '_views_sort_arrays');
      foreach ($arguments as $name => $arg) {
        if ($arg['option'] && !is_array($arg['option'])) {
          if ($arg['option'] == 'string' || $arg['option'] == 'integer') {
            $arg['option'] = array(
              '#type' => 'textfield',
              '#size' => 10,
              '#maxlength' => 255,
            );
          }
          else {
            $arg['option'] = array(
              '#type' => 'select',
              '#options' => $arg['option'],
            );
          }
        }
        $views_arguments['base'][$name] = $arg['name'];
        $views_arguments['title'][$name] = $arg;
      }
      $cache = $views_arguments;
      cache_set("views_arguments:{$locale}", 'cache_views', serialize($cache));
    }
  }
  return $titles ? $views_arguments['base'] : $views_arguments['title'];
}