diff --git a/plugins/export_ui/views_ui.class.php b/plugins/export_ui/views_ui.class.php index f8f1f1c9c1c54accbf8f75b9195a5c2bc1db4fa8..eb334a319427c1365b4cc7686422767f835f8ff7 100644 --- a/plugins/export_ui/views_ui.class.php +++ b/plugins/export_ui/views_ui.class.php @@ -361,7 +361,13 @@ function add_template_page($js, $input, $name, $step = NULL) { } function set_item_state($state, $js, $input, $item) { - ctools_export_set_object_status($item, $state); + if (!$state) { + $item->enable(); + } + else { + $item->disable(); + } + $item->save(); menu_router_rebuild(); if (!$js) { diff --git a/views.install b/views.install index 826d98d3ec08421b7c7977134b2674f734d6f5b1..149e524487dae961c737775e33e9e31418ac38b8 100644 --- a/views.install +++ b/views.install @@ -38,6 +38,7 @@ function views_schema() { 'load all callback' => 'views_get_all_views', 'load callback' => 'views_storage_load', 'save callback' => 'views_storage_save', + 'status callback' => 'views_storage_status', 'subrecords callback' => 'views_load_display_records', // the variable that holds enabled/disabled status 'status' => 'views_defaults', diff --git a/views.module b/views.module index e17fa825fd29fc55b335fa137780c71fe7770c21..72416dc3c5366e0ba693938eafbb715459a74d55 100644 --- a/views.module +++ b/views.module @@ -1575,7 +1575,7 @@ function views_get_all_views($reset = FALSE) { } /** - * Loads a view with the storage controller. + * Load a view with the storage controller. * * @param string $id * The view name to load. @@ -1589,11 +1589,36 @@ function views_storage_load($id) { return reset($result); } +/** + * Save a view with the storage controller. + * + * @param Drupal\views\View $view + * The view which is saved. + * + * @return + * SAVED_NEW or SAVED_UPDATED is returned depending on the operation + * performed. + */ function views_storage_save(View $view) { $controller = entity_get_controller('view'); return $controller->save($view); } +/** + * Change the status of a view. + * + * @param Drupal\views\View $view + * The view which gets a different status. + */ +function views_storage_status(View $view, $status) { + if (!$status) { + $view->enable(); + } + else { + $view->disable(); + } +} + /** * Returns an array of all enabled views, as fully loaded $view objects. */