You are here

function views_service_import_view in Services 5

Import a view.

1 string reference to 'views_service_import_view'
views_service_service in services/views_service/views_service.module
Implementation of hook_service().

File

services/views_service/views_service.module, line 139
The module which exposes services related to views module

Code

function views_service_import_view($view_export) {
  views_load_cache();
  ob_start();
  eval($view_export);
  ob_end_clean();

  // Views exports don't contain vids, therefore we have to
  // check and see if the view already exists. If so, save
  // the existing vid into our imported view object. Otherwise
  // _views_save_view() will treat this as an insert rather than
  // as an update.
  $existing_view = views_get_view($view->name);
  if ($existing_view) {
    $view->vid = $existing_view->vid;
  }
  views_sanitize_view($view);
  $vid = _views_save_view($view);
  return $vid;
}