comparison core/modules/taxonomy/src/VocabularyForm.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
17 class VocabularyForm extends BundleEntityFormBase { 17 class VocabularyForm extends BundleEntityFormBase {
18 18
19 /** 19 /**
20 * The vocabulary storage. 20 * The vocabulary storage.
21 * 21 *
22 * @var \Drupal\taxonomy\VocabularyStorageInterface. 22 * @var \Drupal\taxonomy\VocabularyStorageInterface
23 */ 23 */
24 protected $vocabularyStorage; 24 protected $vocabularyStorage;
25 25
26 /** 26 /**
27 * Constructs a new vocabulary form. 27 * Constructs a new vocabulary form.
87 '#default_value' => $vocabulary->language()->getId(), 87 '#default_value' => $vocabulary->language()->getId(),
88 ]; 88 ];
89 if ($this->moduleHandler->moduleExists('language')) { 89 if ($this->moduleHandler->moduleExists('language')) {
90 $form['default_terms_language'] = [ 90 $form['default_terms_language'] = [
91 '#type' => 'details', 91 '#type' => 'details',
92 '#title' => $this->t('Terms language'), 92 '#title' => $this->t('Term language'),
93 '#open' => TRUE, 93 '#open' => TRUE,
94 ]; 94 ];
95 $form['default_terms_language']['default_language'] = [ 95 $form['default_terms_language']['default_language'] = [
96 '#type' => 'language_configuration', 96 '#type' => 'language_configuration',
97 '#entity_information' => [ 97 '#entity_information' => [
123 123
124 $status = $vocabulary->save(); 124 $status = $vocabulary->save();
125 $edit_link = $this->entity->link($this->t('Edit')); 125 $edit_link = $this->entity->link($this->t('Edit'));
126 switch ($status) { 126 switch ($status) {
127 case SAVED_NEW: 127 case SAVED_NEW:
128 drupal_set_message($this->t('Created new vocabulary %name.', ['%name' => $vocabulary->label()])); 128 $this->messenger()->addStatus($this->t('Created new vocabulary %name.', ['%name' => $vocabulary->label()]));
129 $this->logger('taxonomy')->notice('Created new vocabulary %name.', ['%name' => $vocabulary->label(), 'link' => $edit_link]); 129 $this->logger('taxonomy')->notice('Created new vocabulary %name.', ['%name' => $vocabulary->label(), 'link' => $edit_link]);
130 $form_state->setRedirectUrl($vocabulary->urlInfo('overview-form')); 130 $form_state->setRedirectUrl($vocabulary->urlInfo('overview-form'));
131 break; 131 break;
132 132
133 case SAVED_UPDATED: 133 case SAVED_UPDATED:
134 drupal_set_message($this->t('Updated vocabulary %name.', ['%name' => $vocabulary->label()])); 134 $this->messenger()->addStatus($this->t('Updated vocabulary %name.', ['%name' => $vocabulary->label()]));
135 $this->logger('taxonomy')->notice('Updated vocabulary %name.', ['%name' => $vocabulary->label(), 'link' => $edit_link]); 135 $this->logger('taxonomy')->notice('Updated vocabulary %name.', ['%name' => $vocabulary->label(), 'link' => $edit_link]);
136 $form_state->setRedirectUrl($vocabulary->urlInfo('collection')); 136 $form_state->setRedirectUrl($vocabulary->urlInfo('collection'));
137 break; 137 break;
138 } 138 }
139 139