Mercurial > hg > isophonics-drupal-site
diff core/modules/taxonomy/src/VocabularyListBuilder.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
line wrap: on
line diff
--- a/core/modules/taxonomy/src/VocabularyListBuilder.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/taxonomy/src/VocabularyListBuilder.php Thu Feb 28 13:21:36 2019 +0000 @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; @@ -46,6 +47,13 @@ protected $renderer; /** + * The messenger. + * + * @var \Drupal\Core\Messenger\MessengerInterface + */ + protected $messenger; + + /** * Constructs a new VocabularyListBuilder object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type @@ -56,13 +64,20 @@ * The entity manager service. * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer service. + * @param \Drupal\Core\Messenger\MessengerInterface $messenger + * The messenger. */ - public function __construct(EntityTypeInterface $entity_type, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer = NULL) { + public function __construct(EntityTypeInterface $entity_type, + AccountInterface $current_user, + EntityTypeManagerInterface $entity_type_manager, + RendererInterface $renderer = NULL, + MessengerInterface $messenger) { parent::__construct($entity_type, $entity_type_manager->getStorage($entity_type->id())); $this->currentUser = $current_user; $this->entityTypeManager = $entity_type_manager; $this->renderer = $renderer; + $this->messenger = $messenger; } /** @@ -73,7 +88,8 @@ $entity_type, $container->get('current_user'), $container->get('entity_type.manager'), - $container->get('renderer') + $container->get('renderer'), + $container->get('messenger') ); } @@ -161,7 +177,7 @@ $this->renderer->addCacheableDependency($build['table'], $create_access); if ($create_access->isAllowed()) { $build['table']['#empty'] = t('No vocabularies available. <a href=":link">Add vocabulary</a>.', [ - ':link' => Url::fromRoute('entity.taxonomy_vocabulary.add_form')->toString() + ':link' => Url::fromRoute('entity.taxonomy_vocabulary.add_form')->toString(), ]); } else { @@ -189,7 +205,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); - drupal_set_message(t('The configuration options have been saved.')); + $this->messenger->addStatus($this->t('The configuration options have been saved.')); } }