Commit 3c70b95b authored by hanoii's avatar hanoii

Removing an accidental update hook

parent 11448dcc
...@@ -77,37 +77,6 @@ function draggableviews_schema() { ...@@ -77,37 +77,6 @@ function draggableviews_schema() {
* Implements hook_update(). * Implements hook_update().
*/ */
function draggableviews_update_8104(&$sandbox) { function draggableviews_update_8104(&$sandbox) {
$views = Views::getEnabledViews(); // the update hook here accidentally cropped in into 1.1 but it shouldn't be
foreach ($views as $view) { // there, I belivee that removing it should be harmless.
$source_value = '';
$config = \Drupal::config('views.view.' . $view->id());
$rawData = $config->getRawData();
$master = FALSE;
// Get the display with the draggableviews field.
// It is a little tricky because the 'default' display is the master.
foreach ($rawData['display'] as $display_key => $display) {
$field = isset($display['display_options']['fields']) ? $display['display_options']['fields'] : [];
if ($display_key == 'default' && array_key_exists('draggableviews', $field)) {
$master = TRUE;
}
if ($display_key != 'default' && array_key_exists('draggableviews', $field)) {
$source_value = $view->id() . '|' . $display_key;
}
if ($master && empty($display['display_options']['fields'])) {
$source_value = $view->id() . '|' . $display_key;
}
}
if ($source_value) {
// Save the view with the source value in the sort handler.
foreach ($rawData['display'] as $display_key => $display) {
$sorts = isset($display['display_options']['sorts']) ? $display['display_options']['sorts'] : [];
if (array_key_exists('weight', $sorts)) {
$view_exec = Views::getView($view->id());
$view_exec->setHandlerOption($display_key, 'sort', 'weight', 'source', $source_value);
$view_exec->save();
}
}
}
}
} }
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