comparison core/modules/taxonomy/src/VocabularyForm.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
120 120
121 // Prevent leading and trailing spaces in vocabulary names. 121 // Prevent leading and trailing spaces in vocabulary names.
122 $vocabulary->set('name', trim($vocabulary->label())); 122 $vocabulary->set('name', trim($vocabulary->label()));
123 123
124 $status = $vocabulary->save(); 124 $status = $vocabulary->save();
125 $edit_link = $this->entity->link($this->t('Edit')); 125 $edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString();
126 switch ($status) { 126 switch ($status) {
127 case SAVED_NEW: 127 case SAVED_NEW:
128 $this->messenger()->addStatus($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->toUrl('overview-form'));
131 break; 131 break;
132 132
133 case SAVED_UPDATED: 133 case SAVED_UPDATED:
134 $this->messenger()->addStatus($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->toUrl('collection'));
137 break; 137 break;
138 } 138 }
139 139
140 $form_state->setValue('vid', $vocabulary->id()); 140 $form_state->setValue('vid', $vocabulary->id());
141 $form_state->set('vid', $vocabulary->id()); 141 $form_state->set('vid', $vocabulary->id());