Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions classes/search/MonographSearchIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,16 @@ public function rebuildIndex($log = false, $press = null, $switches = [])
protected function _flattenLocalizedArray($arrayWithLocales)
{
$flattenedArray = [];

foreach ($arrayWithLocales as $localeArray) {
$flattenedArray = array_merge(
$flattenedArray,
$names = array_map(
static fn ($item) => $item['name'],
$localeArray
);

$flattenedArray = array_merge($flattenedArray, $names);
}

return $flattenedArray;
}
}
4 changes: 2 additions & 2 deletions plugins/generic/dublinCoreMeta/DublinCoreMetaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ public function monographView($hookName, $args)
if ($subjects = $publication->getData('subjects')) {
foreach ($subjects as $locale => $localeSubjects) {
foreach ($localeSubjects as $i => $subject) {
$templateMgr->addHeader('dublinCoreSubject' . $locale . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(LocaleConversion::toBcp47($locale)) . '" content="' . htmlspecialchars($subject) . '"/>');
$templateMgr->addHeader('dublinCoreSubject' . $locale . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(LocaleConversion::toBcp47($locale)) . '" content="' . htmlspecialchars($subject['name']) . '"/>');
}
}
}
if ($keywords = $publication->getData('keywords')) {
foreach ($keywords as $locale => $localeKeywords) {
foreach ($localeKeywords as $i => $keyword) {
$templateMgr->addHeader('dublinCoreKeyword' . $locale . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(LocaleConversion::toBcp47($locale)) . '" content="' . htmlspecialchars($keyword) . '"/>');
$templateMgr->addHeader('dublinCoreKeyword' . $locale . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(LocaleConversion::toBcp47($locale)) . '" content="' . htmlspecialchars($keyword['name']) . '"/>');
}
}
}
Expand Down
25 changes: 14 additions & 11 deletions plugins/metadata/dc11/filter/Dc11SchemaPublicationFormatAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use APP\publicationFormat\PublicationFormat;
use APP\section\Section;
use APP\submission\Submission;
use PKP\controlledVocab\ControlledVocab;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\i18n\LocaleConversion;
Expand Down Expand Up @@ -91,16 +90,20 @@ public function extractMetadataFromDataObject(&$publicationFormat)

// Subject
$subjects = array_merge_recursive(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
),
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
)
collect($publication->getData('keywords'))
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all(),
collect($publication->getData('subjects'))
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all()
);
$this->_addLocalizedElements($dc11Description, 'dc:subject', $subjects);

Expand Down
49 changes: 28 additions & 21 deletions plugins/reports/monographReport/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use Illuminate\Support\LazyCollection;
use IteratorAggregate;
use PKP\category\Category;
use PKP\controlledVocab\ControlledVocab;
use PKP\facades\Locale;
use PKP\security\Role;
use PKP\stageAssignment\StageAssignment;
Expand Down Expand Up @@ -365,11 +364,13 @@ private function getStatus(): string
private function getKeywords(): string
{
return $this->flattenKeywords(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$this->publication->getId()
)
collect($this->publication->getData('keywords') ?? [])
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all()
);
}

Expand All @@ -379,11 +380,13 @@ private function getKeywords(): string
private function getSubjects(): string
{
return $this->flattenKeywords(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$this->publication->getId()
)
collect($this->publication->getData('subjects') ?? [])
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all()
);
}

Expand All @@ -393,11 +396,13 @@ private function getSubjects(): string
private function getDisciplines(): string
{
return $this->flattenKeywords(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_DISCIPLINE,
Application::ASSOC_TYPE_PUBLICATION,
$this->publication->getId()
)
collect($this->publication->getData('disciplines') ?? [])
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all()
);
}

Expand All @@ -407,11 +412,13 @@ private function getDisciplines(): string
private function getAgencies(): string
{
return $this->flattenKeywords(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_AGENCY,
Application::ASSOC_TYPE_PUBLICATION,
$this->publication->getId()
)
collect($this->publication->getData('supportingAgencies') ?? [])
->map(
fn (array $items): array => collect($items)
->pluck('name')
->all()
)
->all()
);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/frontend/objects/monograph_full.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</h2>
<span class="value">
{foreach name="keywords" from=$publication->getLocalizedData('keywords') item=keyword}
{$keyword|escape}{if !$smarty.foreach.keywords.last}, {/if}
{$keyword.name|escape}{if !$smarty.foreach.keywords.last}{translate key="common.commaListSeparator"}{/if}
{/foreach}
</span>
</div>
Expand Down