Fix relative logo URL not showing up
This commit is contained in:
parent
bae2f78f3f
commit
cb21eafa43
|
@ -14,6 +14,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
class FeedService
|
class FeedService
|
||||||
{
|
{
|
||||||
protected string $baseFeedUrl;
|
protected string $baseFeedUrl;
|
||||||
|
protected string $baseImageUrl;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected EntityManagerInterface $entityManager,
|
protected EntityManagerInterface $entityManager,
|
||||||
|
@ -21,11 +22,13 @@ class FeedService
|
||||||
UrlGeneratorInterface $urlGenerator,
|
UrlGeneratorInterface $urlGenerator,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->baseFeedUrl = $urlGenerator->generate(
|
$rootUrl = $urlGenerator->generate(
|
||||||
'app_index',
|
'app_index',
|
||||||
[],
|
[],
|
||||||
UrlGeneratorInterface::ABSOLUTE_URL
|
UrlGeneratorInterface::ABSOLUTE_URL
|
||||||
) . Constants::FILES_BASE_PATH;
|
);
|
||||||
|
$this->baseFeedUrl = $rootUrl . Constants::FILES_BASE_PATH;
|
||||||
|
$this->baseImageUrl = $rootUrl . Constants::IMAGES_BASE_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
public const DOCUMENT_VERSION = '2.0';
|
public const DOCUMENT_VERSION = '2.0';
|
||||||
|
@ -43,11 +46,14 @@ class FeedService
|
||||||
$titleElement->appendChild(new DOMText($podcast->getName()));
|
$titleElement->appendChild(new DOMText($podcast->getName()));
|
||||||
$channelElement->appendChild(new DOMElement('description', $podcast->getDescription()));
|
$channelElement->appendChild(new DOMElement('description', $podcast->getDescription()));
|
||||||
$channelElement->appendChild(new DOMElement('link', $podcast->getWebsite()));
|
$channelElement->appendChild(new DOMElement('link', $podcast->getWebsite()));
|
||||||
|
$logoFilename = $podcast->getLogoFilename();
|
||||||
|
if ($logoFilename !== null) {
|
||||||
$imageElement = new DOMElement('image');
|
$imageElement = new DOMElement('image');
|
||||||
$channelElement->appendChild($imageElement);
|
$channelElement->appendChild($imageElement);
|
||||||
$imageElement->appendChild(new DOMElement('url', $podcast->getLogoUrl()));
|
$imageElement->appendChild(new DOMElement('url', $this->baseImageUrl . $logoFilename));
|
||||||
$imageElement->appendChild(new DOMElement('title', 'logo'));
|
$imageElement->appendChild(new DOMElement('title', 'logo'));
|
||||||
$imageElement->appendChild(new DOMElement('link', $podcast->getWebsite()));
|
$imageElement->appendChild(new DOMElement('link', $podcast->getWebsite()));
|
||||||
|
}
|
||||||
|
|
||||||
$episodes = $this->entityManager->createQuery(
|
$episodes = $this->entityManager->createQuery(
|
||||||
'SELECT e FROM App\Entity\Episode e'
|
'SELECT e FROM App\Entity\Episode e'
|
||||||
|
|
Loading…
Reference in a new issue