X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fbook%2Fsrc%2FForm%2FBookOutlineForm.php;fp=web%2Fcore%2Fmodules%2Fbook%2Fsrc%2FForm%2FBookOutlineForm.php;h=a305681d5349622ebf0ddaa14fb7c72a05e1d8ae;hp=f7ea043ed2ebf6d3ccbdc97807c62a67b828d5fe;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/book/src/Form/BookOutlineForm.php b/web/core/modules/book/src/Form/BookOutlineForm.php index f7ea043ed..a305681d5 100644 --- a/web/core/modules/book/src/Form/BookOutlineForm.php +++ b/web/core/modules/book/src/Form/BookOutlineForm.php @@ -5,7 +5,7 @@ namespace Drupal\book\Form; use Drupal\book\BookManagerInterface; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; @@ -35,8 +35,8 @@ class BookOutlineForm extends ContentEntityForm { /** * Constructs a BookOutlineForm object. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. + * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository + * The entity repository. * @param \Drupal\book\BookManagerInterface $book_manager * The BookManager service. * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info @@ -44,8 +44,8 @@ class BookOutlineForm extends ContentEntityForm { * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. */ - public function __construct(EntityManagerInterface $entity_manager, BookManagerInterface $book_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) { - parent::__construct($entity_manager, $entity_type_bundle_info, $time); + public function __construct(EntityRepositoryInterface $entity_repository, BookManagerInterface $book_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) { + parent::__construct($entity_repository, $entity_type_bundle_info, $time); $this->bookManager = $book_manager; } @@ -54,7 +54,7 @@ class BookOutlineForm extends ContentEntityForm { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), + $container->get('entity.repository'), $container->get('book.manager'), $container->get('entity_type.bundle.info'), $container->get('datetime.time') @@ -113,7 +113,7 @@ class BookOutlineForm extends ContentEntityForm { ); $book_link = $form_state->getValue('book'); if (!$book_link['bid']) { - drupal_set_message($this->t('No changes were made')); + $this->messenger()->addStatus($this->t('No changes were made')); return; } @@ -121,15 +121,15 @@ class BookOutlineForm extends ContentEntityForm { if ($this->bookManager->updateOutline($this->entity)) { if (isset($this->entity->book['parent_mismatch']) && $this->entity->book['parent_mismatch']) { // This will usually only happen when JS is disabled. - drupal_set_message($this->t('The post has been added to the selected book. You may now position it relative to other pages.')); + $this->messenger()->addStatus($this->t('The post has been added to the selected book. You may now position it relative to other pages.')); $form_state->setRedirectUrl($this->entity->urlInfo('book-outline-form')); } else { - drupal_set_message($this->t('The book outline has been updated.')); + $this->messenger()->addStatus($this->t('The book outline has been updated.')); } } else { - drupal_set_message($this->t('There was an error adding the post to the book.'), 'error'); + $this->messenger()->addError($this->t('There was an error adding the post to the book.')); } }