function views_revert_view

Revert a specified view.

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...

Parameters

object $view: The view object to be reverted.

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 238

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,
        )));
    }
}