$form['terms'] = [
'#type' => 'table',
'#empty' => $empty,
+ '#header' => [
+ 'term' => $this->t('Name'),
+ 'operations' => $this->t('Operations'),
+ 'weight' => $this->t('Weight'),
+ ],
'#attributes' => [
'id' => 'taxonomy',
],
// 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;
$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',
];
}
- $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'] = [
$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.'));
}
/**