diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php index 7747078..b250f54 100644 --- a/core/modules/views_ui/src/ViewFormBase.php +++ b/core/modules/views_ui/src/ViewFormBase.php @@ -52,8 +52,10 @@ public function buildForm(array $form, FormStateInterface $form_state, $display_ protected function prepareEntity() { // Determine the displays available for editing. if ($tabs = $this->getDisplayTabs($this->entity)) { - // If a display isn't specified, use the first one. if (empty($this->displayID)) { + // If a display isn't specified, use the first one after sorting by + // #weight. + uasort($tabs, 'Drupal\Component\Utility\SortArray::sortByWeightProperty'); foreach ($tabs as $id => $tab) { if (!isset($tab['#access']) || $tab['#access']) { $this->displayID = $id;