diff --git a/web/modules/custom/dpl_redia_legacy/src/Controller/RssFeeds/EventsController.php b/web/modules/custom/dpl_redia_legacy/src/Controller/RssFeeds/EventsController.php index ea7689869..0a0516549 100644 --- a/web/modules/custom/dpl_redia_legacy/src/Controller/RssFeeds/EventsController.php +++ b/web/modules/custom/dpl_redia_legacy/src/Controller/RssFeeds/EventsController.php @@ -5,7 +5,7 @@ use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableResponse; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\File\FileUrlGeneratorInterface; use Drupal\Core\Url; use Drupal\dpl_redia_legacy\RediaEvent; @@ -23,6 +23,7 @@ class EventsController extends ControllerBase { */ public function __construct( protected FileUrlGeneratorInterface $fileUrlGenerator, + protected DateFormatterInterface $dateFormatter, ) {} /** @@ -30,8 +31,8 @@ public function __construct( */ public static function create(ContainerInterface $container): static { return new static( - $container->get('file_url_generator') - + $container->get('file_url_generator'), + $container->get('date.formatter'), ); } @@ -74,7 +75,7 @@ private function getItems(): array { $ids = $query->execute(); /** @var \Drupal\recurring_events\Entity\EventInstance[] $events */ - $events = $this->entityTypeManager()->getStorage('eventinstance')->loadMultiple($ids); + $events = $storage->loadMultiple($ids); $items = []; @@ -101,8 +102,7 @@ private function buildRss(array $items, Request $request): string { $feed_url->setAbsolute(); $feed_url = $feed_url->toString(); - $current_date = new DrupalDateTime(); - $date = $current_date->format('r'); + $date = $this->dateFormatter->format(time(), 'custom', 'r'); $rss_feed = << diff --git a/web/modules/custom/dpl_redia_legacy/src/RediaEvent.php b/web/modules/custom/dpl_redia_legacy/src/RediaEvent.php index cb8f861c3..f3cf51550 100644 --- a/web/modules/custom/dpl_redia_legacy/src/RediaEvent.php +++ b/web/modules/custom/dpl_redia_legacy/src/RediaEvent.php @@ -61,6 +61,8 @@ public function __construct(EventInstance $event_instance) { $this->subtitle = $event_wrapper->getField('event_description')?->getString(); $this->startTime = $start_date->format('U'); $this->endTime = $end_date->format('U'); + $this->media = NULL; + $this->mediaThumbnail = NULL; if ($media) { $this->media = new RediaEventMedia($media, 'redia_feed_large'); diff --git a/web/modules/custom/dpl_redia_legacy/src/RediaEventMedia.php b/web/modules/custom/dpl_redia_legacy/src/RediaEventMedia.php index 15bbf5439..e7a738800 100644 --- a/web/modules/custom/dpl_redia_legacy/src/RediaEventMedia.php +++ b/web/modules/custom/dpl_redia_legacy/src/RediaEventMedia.php @@ -16,12 +16,12 @@ class RediaEventMedia extends ControllerBase { // We'll disable the documentation rules for the member properties, as // they are pretty self-explanatory. // phpcs:disable - public ?string $url; - public ?int $size; - public ?int $width; - public ?int $height; - public ?string $type; - public ?string $md5; + public ?string $url = NULL; + public ?int $size = NULL; + public ?int $width = NULL; + public ?int $height = NULL; + public ?string $type = NULL; + public ?string $md5 = NULL; public string $medium = 'image'; // phpcs:enable @@ -50,7 +50,7 @@ public function __construct(MediaInterface $media, string $image_style) { $image_sizes = getimagesize($file_uri); $file_size = filesize($file_uri); - $image_type = exif_imagetype($file_uri); + $image_type = $image_sizes[2] ?? NULL; if ($image_type) { $this->type = image_type_to_mime_type($image_type); diff --git a/web/modules/custom/dpl_update/dpl_update.install b/web/modules/custom/dpl_update/dpl_update.install index 8d4ccf2ea..ce58aceb4 100644 --- a/web/modules/custom/dpl_update/dpl_update.install +++ b/web/modules/custom/dpl_update/dpl_update.install @@ -212,7 +212,7 @@ function dpl_update_update_10017(): string { } /** - * Install dpl_search module. + * Install dpl_redia_legacy module. */ function dpl_update_update_10018(): string { return _dpl_update_install_modules(['dpl_redia_legacy']);