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 c437da0 commit 1285062
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.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ 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) {
$coverImage = $this->getLocalizedData('coverImage');
public function getLocalizedCoverImageUrl($contextId, $preferredLocale = null) {
$coverImage = $this->getLocalizedData('coverImage', $preferredLocale);

if (!$coverImage) {
return Application::get()->getRequest()->getBaseUrl() . '/templates/images/book-default.png';
Expand Down Expand Up @@ -73,4 +74,4 @@ public function getLocalizedCoverImageThumbnailUrl($contextId) {
Services::get('publication')->getThumbnailFilename($pathParts['basename']),
]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ 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 1285062

Please sign in to comment.