Skip to content

Commit

Permalink
pkp/pkp-lib#9927 set optional locale param for getLocalizedCoverImageUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson committed Jun 13, 2024
1 parent 59eb9f1 commit 61f1933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions classes/publication/Publication.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ public function getEditorString()
* Get the URL to a localized cover image
*
* @param int $contextId
*
* @param string $preferredLocale Return the cover image in a specified locale.
*
* @return string
*/
public function getLocalizedCoverImageUrl($contextId)
public function getLocalizedCoverImageUrl($contextId, $preferredLocale = null)
{
$coverImage = $this->getLocalizedData('coverImage');
$coverImage = $this->getLocalizedData('coverImage', $preferredLocale);

if (!$coverImage) {
return Application::get()->getRequest()->getBaseUrl() . '/templates/images/book-default.png';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public function createProductNode($doc, $submission, $publicationFormat)
$resourceVersionNode = $doc->createElementNS($deployment->getNamespace(), 'ResourceVersion');
$supportingResourceNode->appendChild($resourceVersionNode);
$resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceForm', '01')); // Linkable resource
$resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceLink', $publication->getLocalizedCoverImageUrl($context->getId())));
$resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceLink', $publication->getLocalizedCoverImageUrl($context->getId(), $publication->getData('locale'))));

/* --- Publishing Detail --- */

Expand Down

0 comments on commit 61f1933

Please sign in to comment.