You are here

function _get_aliasable_displays in View Alias 6.2

Same name and namespace in other branches
  1. 7 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 vocab id for the terms used array( 0 => object ( 'view_name' -> 'viewname' 'display_name' -> 'display name' 'path' -> 'view url path' 'varg' -> 'vocabulary id' ) )

4 calls to _get_aliasable_displays()
view_alias_form_alter in ./view_alias.module
Implementation of hook_form_alter remove the default form settings and add our own since view alias are different from the regular alaises
view_alias_pathauto_bulkupdate in ./view_alias.module
Do the bulk updating for view aliases
view_alias_path_alias_types in ./view_alias.module
Implementation of hook_path_alais_types from pathauto allows me to hook into the bulk delete
view_alias_taxonomy in ./view_alias.module
Implementation of hook_taxonomy().

File

./view_alias.module, line 192
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->path = $display->display_options['path'];
      if (isset($display->display_options['defaults']['arguments']) && $display->display_options['defaults']['arguments'] === FALSE) {
        $alias->varg = _find_view_arguments($display);
      }
      else {

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