You are here

function _views_check_arrays in Views (for Drupal 7) 5

Ensure that all the arrays in a view exist so we don't run into array operations on a non-array error.

5 calls to _views_check_arrays()
views_create_view in ./views.module
Create a blank view.
views_edit_view in ./views_ui.module
Display all the guts of a view in a form for editing.
views_sanitize_view in ./views_cache.inc
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.
_views_get_default_view in ./views_ui.module
_views_save_view in ./views.module
Save a view to the database.

File

./views.module, line 355

Code

function _views_check_arrays(&$view) {
  $fields = array(
    'field',
    'sort',
    'argument',
    'filter',
    'exposed_filter',
    'access',
  );
  foreach ($fields as $field) {
    if (!is_array($view->{$field})) {
      $view->{$field} = array();
    }
  }
  return $view;
}