Commit ec2a9505 authored by dawehner's avatar dawehner Committed by tim.plunkett

Override CTools callback to load view objects via the entity controller.

parent aae02bde
......@@ -35,6 +35,9 @@ function views_schema() {
),
'object' => 'Drupal\views\View',
// the callback to load the displays
'load all callback' => 'views_get_all_views',
'load callback' => 'views_storage_load',
'save callback' => 'views_storage_save',
'subrecords callback' => 'views_load_display_records',
// the variable that holds enabled/disabled status
'status' => 'views_defaults',
......
......@@ -1572,8 +1572,28 @@ function views_get_applicable_views($type) {
*/
function views_get_all_views($reset = FALSE) {
// @todo replace with http://drupal.org/node/1741154.
ctools_include('export');
return ctools_export_crud_load_all('views_view', $reset);
$controller = entity_get_controller('view');
return $controller->load();
}
/**
* Loads a view with the storage controller.
*
* @param string $id
* The view name to load.
*
* @return Drupal\views\View
* The view which is loaded.
*/
function views_storage_load($id) {
$controller = entity_get_controller('view');
$result = $controller->load(array($id));
return reset($result);
}
function views_storage_save(View $view) {
$controller = entity_get_controller('view');
return $controller->save($view);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment