You are here

function _get_aliasable_displays in View Alias 7

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

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 ( 'view_name' -> 'viewname' 'display_name' -> 'display name' 'path' -> 'view url path' 'vid' -> 'vocabulary id' ) )

4 calls to _get_aliasable_displays()
view_alias_form_alter in ./view_alias.module
Implements hook_form_alter(). remove the default form settings and add our own since view alias are different from the regular aliases
view_alias_pathauto_bulkupdate in ./view_alias.module
Batch processing callback; Generate aliases for taxonomy terms.
view_alias_path_alias_types in ./view_alias.module
Implements hook_path_alias_types(). allows me to hook into the bulk delete
view_alias_variable_info in ./view_alias.variable.inc

File

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

Code

function _get_aliasable_displays() {
  $aliasable_views = array();
  $views = views_get_all_views();
  foreach ($views as $view) {
    if (!empty($view->disabled)) {
      continue;
    }
    if (empty($view->display)) {
      continue;
    }
    $alias = new stdClass();
    $alias->view_name = $view->name;
    foreach ($view->display as $key => $display) {

      // check default for args and save for later
      if ($key == 'default') {
        $default_varg = _find_view_arguments($display);
        continue;
      }

      // Skip displays with no path
      if (empty($display->display_options['path'])) {
        continue;
      }

      // Add the display name, path and replace overridden args.
      $alias->display_name = $key;
      $alias->bundle = $alias->view_name . '-' . $alias->display_name;
      $alias->path = $display->display_options['path'];
      if (isset($display->display_options['defaults']['arguments']) && $display->display_options['defaults']['arguments'] === FALSE) {
        $alias->vargs = _find_view_arguments($display);
      }
      else {

        // Restore default varg -- previous displays may have been overridden
        $alias->vargs = $default_varg;
      }
      if (!empty($alias->path) && !empty($alias->vargs)) {
        $aliasable_views[] = clone $alias;
      }
    }
  }
  return $aliasable_views;
}