Commit 7d08e330 authored by alexpott's avatar alexpott

Issue #2552797 by amateescu: Remove \Drupal\views_ui\ViewEditForm::addMicroweights()

parent 08beef03
...@@ -668,12 +668,10 @@ public function rebuildCurrentTab(ViewUI $view, AjaxResponse $response, $display ...@@ -668,12 +668,10 @@ public function rebuildCurrentTab(ViewUI $view, AjaxResponse $response, $display
// Regenerate the main display area. // Regenerate the main display area.
$build = $this->getDisplayTab($view); $build = $this->getDisplayTab($view);
static::addMicroweights($build);
$response->addCommand(new HtmlCommand('#views-tab-' . $display_id, $build)); $response->addCommand(new HtmlCommand('#views-tab-' . $display_id, $build));
// Regenerate the top area so changes to display names and order will appear. // Regenerate the top area so changes to display names and order will appear.
$build = $this->renderDisplayTop($view); $build = $this->renderDisplayTop($view);
static::addMicroweights($build);
$response->addCommand(new ReplaceCommand('#views-display-top', $build)); $response->addCommand(new ReplaceCommand('#views-display-top', $build));
} }
...@@ -1148,22 +1146,4 @@ public function getFormBucket(ViewUI $view, $type, $display) { ...@@ -1148,22 +1146,4 @@ public function getFormBucket(ViewUI $view, $type, $display) {
return $build; return $build;
} }
/**
* Recursively adds microweights to a render array, similar to what
* \Drupal::formBuilder()->doBuildForm() does for forms.
*
* @todo Submit a core patch to fix drupal_render() to do this, so that all
* render arrays automatically preserve array insertion order, as forms do.
*/
public static function addMicroweights(&$build) {
$count = 0;
foreach (Element::children($build) as $key) {
if (!isset($build[$key]['#weight'])) {
$build[$key]['#weight'] = $count/1000;
}
static::addMicroweights($build[$key]);
$count++;
}
}
} }
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