Skip to content

Commit

Permalink
pkp/pkp-lib#10671 controlled vocab metadata set by publication modified
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Jan 24, 2025
1 parent fe7613b commit e703a5f
Showing 1 changed file with 37 additions and 42 deletions.
79 changes: 37 additions & 42 deletions classes/form/SubmissionMetadataForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ public function __construct($parentForm = null)
*/
public function _getAbstractsRequired($submission)
{
$section = Repo::section()->get($submission->getCurrentPublication()->getData('sectionId'), $submission->getData('contextId'));
$section = Repo::section()
->get(
$submission->getCurrentPublication()->getData('sectionId'),
$submission->getData('contextId')
);

return !$section->getAbstractsNotRequired();
}

Expand Down Expand Up @@ -147,45 +152,11 @@ public function initData($submission)
$this->_parentForm->setData($key, $data);
}

// get the supported locale keys
$locales = array_keys($this->_parentForm->supportedLocales);

$this->_parentForm->setData(
'subjects',
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
)
);
$this->_parentForm->setData(
'keywords',
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
)
);
$this->_parentForm->setData(
'disciplines',
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_DISCIPLINE,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
)
);
$this->_parentForm->setData(
'agencies',
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_AGENCY,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId()
)
);
$this->_parentForm->setData(
'abstractsRequired',
$this->_getAbstractsRequired($submission)
);
$this->_parentForm->setData('subjects', $publication->getData('subjects'));
$this->_parentForm->setData('keywords', $publication->getData('keywords'));
$this->_parentForm->setData('disciplines', $publication->getData('disciplines'));
$this->_parentForm->setData('agencies', $publication->getData('supportingAgencies'));
$this->_parentForm->setData('abstractsRequired', $this->_getAbstractsRequired($submission));
}
}

Expand All @@ -195,7 +166,21 @@ public function initData($submission)
public function readInputData()
{
// 'keywords' is a tagit catchall that contains an array of values for each keyword/locale combination on the form.
$userVars = ['title', 'prefix', 'subtitle', 'abstract', 'coverage', 'type', 'source', 'rights', 'keywords', 'citationsRaw', 'locale', 'dataAvailability'];
$userVars = [
'title',
'prefix',
'subtitle',
'abstract',
'coverage',
'type',
'source',
'rights',
'keywords',
'citationsRaw',
'locale',
'dataAvailability',
];

$this->_parentForm->readUserVars($userVars);
}

Expand All @@ -206,7 +191,17 @@ public function readInputData()
*/
public function getLocaleFieldNames()
{
return ['title', 'prefix', 'subtitle', 'abstract', 'coverage', 'type', 'source', 'rights', 'dataAvailability'];
return [
'title',
'prefix',
'subtitle',
'abstract',
'coverage',
'type',
'source',
'rights',
'dataAvailability',
];
}

/**
Expand Down

0 comments on commit e703a5f

Please sign in to comment.