Commit 79629a5f authored by dawehner's avatar dawehner Committed by tim.plunkett

Get rid of more CTools export code.

parent e4abe393
......@@ -34,22 +34,15 @@ function views_schema() {
'current_version' => '3.0',
),
'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',
'status callback' => 'views_storage_status',
'subrecords callback' => 'views_load_display_records',
// the variable that holds enabled/disabled status
'status' => 'views_defaults',
// CRUD callbacks
'create callback' => 'views_new_view',
'save callback' => 'views_save_view',
'delete callback' => 'views_delete_view',
'export callback' => 'views_export_view',
'status callback' => 'views_export_status',
'cache defaults' => TRUE,
'default cache bin' => 'cache_views',
),
'fields' => array(
'vid' => array(
......
......@@ -1766,48 +1766,6 @@ function views_move_table($table) {
return $table;
}
/**
* Export callback to load the view subrecords, which are the displays.
*/
function views_load_display_records(&$views) {
// Get vids from the views.
$names = array();
foreach ($views as $view) {
if (empty($view->display)) {
$names[$view->vid] = $view->name;
}
}
if (empty($names)) {
return;
}
foreach (View::db_objects() as $key => $object) {
$table_name = "views_" . $key;
$object_name = 'Drupal\views\Views' . $object;
$result = db_query("SELECT * FROM {{$table_name}} WHERE vid IN (:vids) ORDER BY vid, position",
array(':vids' => array_keys($names)));
foreach ($result as $data) {
$object = new $object_name(FALSE);
$object->load_row($data);
// Because it can get complicated with this much indirection,
// make a shortcut reference.
$location = &$views[$names[$object->vid]]->$key;
// If we have a basic id field, load the item onto the view based on
// this ID, otherwise push it on.
if (!empty($object->id)) {
$location[$object->id] = $object;
}
else {
$location[] = $object;
}
}
}
}
/**
* Export CRUD callback to save a 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