diff -u b/src/ApplenewsPreviewBuilder.php b/src/ApplenewsPreviewBuilder.php --- b/src/ApplenewsPreviewBuilder.php +++ b/src/ApplenewsPreviewBuilder.php @@ -3,7 +3,8 @@ namespace Drupal\applenews; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\File\FileSystem; +use Drupal\Core\File\FileSystemInterface; +use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; /** * Class ApplenewsPreviewBuilder. @@ -102,21 +103,31 @@ /** * File system. * - * @var \Drupal\Core\File\FileSystem + * @var \Drupal\Core\File\FileSystemInterface */ protected $fileSystem; /** + * Stream wrapper. + * + * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface + */ + protected $streamWrapperManager; + + /** * ApplenewsPreviewBuilder constructor. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * Config factory. - * @param \Drupal\Core\File\FileSystem $file_system + * @param \Drupal\Core\File\FileSystemInterface $file_system * File system. + * @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager + * Stream wrapper. */ - public function __construct(ConfigFactoryInterface $config_factory, FileSystem $file_system) { + public function __construct(ConfigFactoryInterface $config_factory, FileSystemInterface $file_system, StreamWrapperManagerInterface $stream_wrapper_manager) { $this->config = $config_factory->get('applenews.settings'); $this->fileSystem = $file_system; + $this->streamWrapperManager = $stream_wrapper_manager; } /** @@ -157,7 +168,7 @@ if ($entity_archive) { $this->removeDirectories([$this->entityId]); } - $this->fileSystem->prepareDirectory($drupal_entity_directory, FILE_CREATE_DIRECTORY); + $this->fileSystem->prepareDirectory($drupal_entity_directory, FileSystemInterface::CREATE_DIRECTORY); } return $this; @@ -245,7 +256,7 @@ */ protected function fileBuildUri($path) { $uri = 'temporary://' . $path; - return file_stream_wrapper_uri_normalize($uri); + return $this->streamWrapperManager->normalizeUri($uri); } /** diff -u b/src/Form/ApplenewsTemplateForm.php b/src/Form/ApplenewsTemplateForm.php --- b/src/Form/ApplenewsTemplateForm.php +++ b/src/Form/ApplenewsTemplateForm.php @@ -393,7 +393,7 @@ } $this->entity->save(); - $this->messenger()->addMessage($this->t('Component added successfully.')); + $this->messenger()->addStatus('Component added successfully.'); $form_state->setRebuild(); } @@ -465,7 +465,7 @@ else { $this->saveComponentOrder($form_state); } - $this->messenger()->addMessage($this->t('Component deleted.')); + $this->messenger()->addStatus('Component deleted.'); $form_state->setRebuild(); } diff -u b/src/Form/TextStyleForm.php b/src/Form/TextStyleForm.php --- b/src/Form/TextStyleForm.php +++ b/src/Form/TextStyleForm.php @@ -44,7 +44,7 @@ */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager')->getStorage('applenews_text_style') + $container->get('entity_type.manager')->getStorage('applenews_text_style') ); } only in patch2: unchanged: --- a/applenews.info.yml +++ b/applenews.info.yml @@ -2,6 +2,7 @@ name: Apple News description: Push content to Apple News. type: module core: 8.x +Add core_version_requirement: ^8 || ^9 package: Apple News configure: applenews.settings dependencies: only in patch2: unchanged: --- a/applenews.services.yml +++ b/applenews.services.yml @@ -42,4 +42,4 @@ services: arguments: ['@config.factory'] applenews.preview_builder: class: Drupal\applenews\ApplenewsPreviewBuilder - arguments: ['@config.factory', '@file_system'] + arguments: ['@config.factory', '@file_system', '@stream_wrapper_manager'] only in patch2: unchanged: --- a/src/Form/ChannelForm.php +++ b/src/Form/ChannelForm.php @@ -6,7 +6,7 @@ use Drupal\applenews\PublisherInterface; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Datetime\DateFormatterInterface; 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\Language\LanguageManagerInterface; @@ -50,8 +50,8 @@ class ChannelForm extends ContentEntityForm { /** * Constructs a MessageForm object. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager service. + * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository + * The entity repository. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager service. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter @@ -63,8 +63,8 @@ class ChannelForm extends ContentEntityForm { * @param \Drupal\applenews\PublisherInterface $publisher * The time service. */ - public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, DateFormatterInterface $date_formatter, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL, PublisherInterface $publisher = NULL) { - parent::__construct($entity_manager, $entity_type_bundle_info, $time); + public function __construct(EntityRepositoryInterface $entity_repository, LanguageManagerInterface $language_manager, DateFormatterInterface $date_formatter, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL, PublisherInterface $publisher = NULL) { + parent::__construct($entity_repository, $entity_type_bundle_info, $time); $this->languageManager = $language_manager; $this->dateFormatter = $date_formatter; $this->publisher = $publisher; @@ -75,7 +75,7 @@ class ChannelForm extends ContentEntityForm { */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), + $container->get('entity.repository'), $container->get('language_manager'), $container->get('date.formatter'), $container->get('entity_type.bundle.info'),