1 views_ui.admin.inc views_ui_toggle_enable_page(view $view, $status)

Menu callback; Enable a view and return to the view listing page.

File

core/modules/views_ui/views_ui.admin.inc, line 2009
Provides the Views' administrative interface.

Code

function views_ui_toggle_enable_page(view $view, $status) {
  // Validate the token for this page.
  if (empty($_GET['token']) || $_GET['token'] !== backdrop_get_token($view->name)) {
    return MENU_ACCESS_DENIED;
  }
  $view->disabled = !$status;
  $view->save();
  if ($status) {
    $message = t('The view %name has been enabled.', array('%name' => $view->get_human_name()));
  }
  else {
    $message = t('The view %name has been disabled.', array('%name' => $view->get_human_name()));
  }
  backdrop_set_message($message);
  backdrop_goto('admin/structure/views');
}