Skip to content
Snippets Groups Projects
Commit 79629a5f authored by Daniel Wehner's avatar Daniel Wehner Committed by Tim Plunkett
Browse files

Get rid of more CTools export code.

parent e4abe393
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment