You are here

function _find_view_arguments in View Alias 7

Same name and namespace in other branches
  1. 6.2 view_alias.module \_find_view_arguments()

helper to dig out the view arguments.

1 call to _find_view_arguments()
_get_aliasable_displays in ./view_alias.module
find the views that can be aliased. that means have a path url and use a term id as an argument build and array of objects, keyed with the view name, having the view path, and the vocabulary id for the terms used array( 0 => object…

File

./view_alias.module, line 377
Hook implementations for view alias module integration.

Code

function _find_view_arguments($display) {

  // No arguments?  Return FALSE.
  if (empty($display->display_options['arguments'])) {
    return FALSE;
  }

  // Scan the display for the first term arg.
  // (No multiple argument support, yet)
  $view_args = array();
  foreach ($display->display_options['arguments'] as $arg_name => $argument) {

    // If we don't support all arguments, we can't create an alias.
    if (empty($argument['validate']) || empty($argument['validate_options']) || $argument['validate']['type'] != 'taxonomy_term') {
      return FALSE;
    }
    $view_args[$arg_name]['vocabularies'] = array_filter($argument['validate_options']['vocabularies']);
    $view_args[$arg_name]['options'] = array();
    if (array_key_exists('depth', $argument)) {
      $view_args[$arg_name]['options']['depth'] = $argument['depth'];
    }
  }
  return $view_args ? $view_args : FALSE;
}