function views_drush_revert_view

Reverts 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_drush_revert_view()
views_drush_revert_allviews in drush/views.drush.inc
Reverts all views
views_drush_revert_views in drush/views.drush.inc
Callback function for views-revert command.

File

drush/views.drush.inc, line 208

Code

function views_drush_revert_view($view) {
    // check anyway just in case
    if ($view->type == t('Overridden')) {
        // Revert the view.
        $view->delete();
        // Clear its cache.
        views_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,
        )));
    }
}