Skip to content

Commit

Permalink
Merge pull request #2632 from NateWr/i5525_category_nesting
Browse files Browse the repository at this point in the history
pkp/pkp-lib#5525 Show category hierarchy when selecting categories
  • Loading branch information
NateWr committed Feb 24, 2020
2 parents 80c9c3a + 64b09a8 commit 2f6f66e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions classes/components/forms/publication/IssueEntryForm.inc.php
Expand Up @@ -97,12 +97,15 @@ public function __construct($action, $locales, $publication, $publicationContext

// Categories
$categoryOptions = [];
$result = \DAORegistry::getDAO('CategoryDAO')->getByContextId($publicationContext->getId());
while (!$result->eof()) {
$category = $result->next();
$categories = \DAORegistry::getDAO('CategoryDAO')->getByContextId($publicationContext->getId())->toAssociativeArray();
foreach ($categories as $category) {
$label = $category->getLocalizedTitle();
if ($category->getParentId()) {
$label = $categories[$category->getParentId()]->getLocalizedTitle() . ' > ' . $label;
}
$categoryOptions[] = [
'value' => (int) $category->getId(),
'label' => $category->getLocalizedTitle(),
'label' => $label,
];
}
if (!empty($categoryOptions)) {
Expand Down

0 comments on commit 2f6f66e

Please sign in to comment.