Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / taxonomy / src / Form / OverviewTerms.php
index df80a47035be0b522cbfd9cdf0809726bb8db4cb..f9e0d595982e6ef0e299ea708bcf7115e9399212 100644 (file)
@@ -241,6 +241,11 @@ class OverviewTerms extends FormBase {
     $form['terms'] = [
       '#type' => 'table',
       '#empty' => $empty,
+      '#header' => [
+        'term' => $this->t('Name'),
+        'operations' => $this->t('Operations'),
+        'weight' => $this->t('Weight'),
+      ],
       '#attributes' => [
         'id' => 'taxonomy',
       ],
@@ -251,6 +256,11 @@ class OverviewTerms extends FormBase {
     // all terms.
     $change_weight_access = AccessResult::allowed();
     foreach ($current_page as $key => $term) {
+      $form['terms'][$key] = [
+        'term' => [],
+        'operations' => [],
+        'weight' => [],
+      ];
       /** @var $term \Drupal\Core\Entity\EntityInterface */
       $term = $this->entityManager->getTranslationFromContext($term);
       $form['terms'][$key]['#term'] = $term;
@@ -344,11 +354,8 @@ class OverviewTerms extends FormBase {
       $row_position++;
     }
 
-    $form['terms']['#header'] = [$this->t('Name')];
-
     $this->renderer->addCacheableDependency($form['terms'], $change_weight_access);
     if ($change_weight_access->isAllowed()) {
-      $form['terms']['#header'][] = $this->t('Weight');
       if ($parent_fields) {
         $form['terms']['#tabledrag'][] = [
           'action' => 'match',
@@ -377,8 +384,6 @@ class OverviewTerms extends FormBase {
       ];
     }
 
-    $form['terms']['#header'][] = $this->t('Operations');
-
     if (($taxonomy_vocabulary->getHierarchy() !== VocabularyInterface::HIERARCHY_MULTIPLE && count($tree) > 1) && $change_weight_access->isAllowed()) {
       $form['actions'] = ['#type' => 'actions', '#tree' => FALSE];
       $form['actions']['submit'] = [
@@ -492,7 +497,7 @@ class OverviewTerms extends FormBase {
       $vocabulary->setHierarchy($hierarchy);
       $vocabulary->save();
     }
-    drupal_set_message($this->t('The configuration options have been saved.'));
+    $this->messenger()->addStatus($this->t('The configuration options have been saved.'));
   }
 
   /**