You are here

function views_sanitize_view in Views (for Drupal 7) 5

Ensures that views have legitimate information; a bit more is stored on the $view object than is in the database, and this isn't necessarily set when a view is constructed externally.

2 calls to views_sanitize_view()
views_ui_admin_import_submit in ./views_ui.module
_views_get_default_views in ./views_cache.inc
Build default view information from all modules and cache it.

File

./views_cache.inc, line 191

Code

function views_sanitize_view(&$view) {
  _views_check_arrays($view);

  // so reference works.
  foreach ($view->field as $i => $field) {
    if (!isset($view->field[$i]['id'])) {
      $view->field[$i]['id'] = $view->field[$i]['fullname'] = "{$field['tablename']}.{$field['field']}";
      $view->field[$i]['queryname'] = "{$field['tablename']}_{$field['field']}";
    }
  }
  foreach ($view->filter as $i => $filter) {
    if (!isset($view->filter[$i]['id'])) {
      $view->filter[$i]['id'] = $view->filter[$i]['field'] = "{$filter['tablename']}.{$filter['field']}";
    }
  }
  foreach ($view->exposed_filter as $i => $exposed_filter) {
    if (!isset($view->exposed_filter[$i]['id'])) {
      $view->exposed_filter[$i]['id'] = $view->exposed_filter[$i]['field'] = "{$exposed_filter['tablename']}.{$exposed_filter['field']}";
    }
  }
  foreach ($view->sort as $i => $sort) {
    if (!isset($view->sort[$i]['id'])) {
      $view->sort[$i]['id'] = $view->sort[$i]['field'] = "{$sort['tablename']}.{$sort['field']}";
    }
  }
  foreach ($view->argument as $i => $argument) {
    if (!isset($view->argument[$i]['id'])) {
      $view->argument[$i]['id'] = $view->argument[$i]['type'];
    }
  }
}