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

8.0.x
Daniel Wehner 2012-08-26 23:25:31 +02:00 committed by Tim Plunkett
parent aae02bde02
commit ec2a950563
2 changed files with 25 additions and 2 deletions

View File

@ -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',

View File

@ -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);
}
/**