You are here

function spaces_core_views_default_views in Spaces 6

Same name and namespace in other branches
  1. 5.2 spaces_core/spaces_core.module \spaces_core_views_default_views()
  2. 5 spaces_core/spaces_core.module \spaces_core_views_default_views()

Implementation of hook_default_views().

File

spaces_core/spaces_core.module, line 127

Code

function spaces_core_views_default_views() {
  $views = array();
  if (module_load_include('inc', 'spaces_core', 'spaces_core_views') !== FALSE) {
    $default_views = _spaces_core_views_list_views();
    foreach ($default_views as $v) {
      $function = '_spaces_core_views_' . $v;
      if (function_exists($function)) {
        $view = call_user_func($function);
        if (is_object($view) && $view->name) {
          $views[$view->name] = $view;
        }
      }
      else {
        watchdog(WATCHDOG_ERROR, 'An exported view could not be loaded because the function !function was not found.', array(
          '!function' => $function,
        ));
      }
    }
  }
  return $views;
}