diff --git a/core/lib/Drupal/Core/Config/Entity/DraggableListController.php b/core/lib/Drupal/Core/Config/Entity/DraggableListController.php index 5370be5..bf541ec 100644 --- a/core/lib/Drupal/Core/Config/Entity/DraggableListController.php +++ b/core/lib/Drupal/Core/Config/Entity/DraggableListController.php @@ -25,13 +25,6 @@ protected $entitiesKey = 'entities'; /** - * The entities being listed. - * - * @var \Drupal\Core\Entity\EntityInterface[] - */ - protected $entities = array(); - - /** * Name of the entity's weight field or FALSE if no field is provided. * * @var string|bool @@ -105,8 +98,8 @@ public function buildForm(array $form, array &$form_state) { ), ); - $this->entities = $this->load(); - foreach ($this->entities as $entity) { + $entities = $this->load(); + foreach ($entities as $entity) { $row = $this->buildRow($entity); if (isset($row['label'])) { $row['label'] = array('#markup' => $row['label']); @@ -135,11 +128,12 @@ public function validateForm(array &$form, array &$form_state) { * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { + $entities = $this->storage->loadMultiple(array_keys($form_state['values'][$this->entitiesKey])); foreach ($form_state['values'][$this->entitiesKey] as $id => $value) { - if (isset($this->entities[$id]) && $this->entities[$id]->get($this->weightKey) != $value['weight']) { + if (isset($entities[$id]) && $entities[$id]->get($this->weightKey) != $value['weight']) { // Save entity only when its weight was changed. - $this->entities[$id]->set($this->weightKey, $value['weight']); - $this->entities[$id]->save(); + $entities[$id]->set($this->weightKey, $value['weight']); + $entities[$id]->save(); } } } diff --git a/core/modules/language/lib/Drupal/language/LanguageListController.php b/core/modules/language/lib/Drupal/language/LanguageListController.php index 35724b7..2ea66cf 100644 --- a/core/modules/language/lib/Drupal/language/LanguageListController.php +++ b/core/modules/language/lib/Drupal/language/LanguageListController.php @@ -84,7 +84,6 @@ public function buildRow(EntityInterface $entity) { */ public function buildForm(array $form, array &$form_state) { $form = parent::buildForm($form, $form_state); - $form[$this->entitiesKey]['#languages'] = $this->entities; $form['actions']['submit']['#value'] = t('Save configuration'); return $form; } diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 30f134e..37bac87 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -694,7 +694,7 @@ function locale_library_info_alter(&$libraries, $module) { * Implements hook_form_FORM_ID_alter() for language_admin_overview_form(). */ function locale_form_language_admin_overview_form_alter(&$form, &$form_state) { - $languages = $form['languages']['#languages']; + $languages = $form_state['build_info']['callback_object']->load(); $total_strings = \Drupal::service('locale.storage')->countStrings(); $stats = array_fill_keys(array_keys($languages), array());