function views_revert_view

3.x views.drush.inc views_revert_view($view)
2.x views_revert.drush.inc views_revert_view($view)

Revert a specified view

Parameters

$view: The view object to be reverted

Checks on wether or not the view is overridden is handled in views_revert_views_revert() We perform a check here anyway in case someone somehow calls this function on their own...

2 calls to views_revert_view()
views_revert_allviews in drush/views.drush.inc
Reverts all views
views_revert_views in drush/views.drush.inc
Callback function for views-revert command.

File

drush/views.drush.inc, line 215
Drush integration of views.

Code

function views_revert_view($view) {
  // check anyway just in case
  if ($view->type == t('Overridden')) {
    // Revert the view.
    $view->delete();
    // Clear its cache.
    ctools_include('object-cache');
    ctools_object_cache_clear('view', $view->name);
    // Give feedback.
    $message = dt("Reverted the view '@viewname'", array('@viewname' => $view->name));
    drush_log($message, 'success');
    // Reverted one more view.
  }
  else {
    drush_set_error(dt("The view '@viewname' is not overridden.", array('@viewname' => $view->name)));
  }
}