Skip to content

Commit

Permalink
Merge pull request #14 from lepidus/main
Browse files Browse the repository at this point in the history
Feature/selects default imprint (OMP 3.4.0)
  • Loading branch information
thiagolepidus authored Oct 22, 2024
2 parents 1f1adbd + c254810 commit c64d302
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions classes/ThothRegister.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function addImprintField($hookName, $form)
$publishers = $thothClient->linkedPublishers();
$imprints = $thothClient->imprints(['publishers' => array_column($publishers, 'publisherId')]);

$imprintOptions = [['value' => '', 'label' => '']];
$imprintOptions = [];
foreach ($imprints as $imprint) {
$imprintOptions[] = [
'value' => $imprint['imprintId'],
Expand All @@ -91,7 +91,8 @@ public function addImprintField($hookName, $form)
'options' => $imprintOptions,
'required' => true,
'showWhen' => 'registerConfirmation',
'groupId' => 'default'
'groupId' => 'default',
'value' => $imprints[0]['imprintId'] ?? null
]));
} catch (ThothException $e) {
$warningIconHtml = '<span class="fa fa-exclamation-triangle pkpIcon--inline"></span>';
Expand Down
5 changes: 3 additions & 2 deletions classes/components/forms/RegisterForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($action, $imprints, $errors)
return;
}

$imprintOptions = [['value' => '', 'label' => '']];
$imprintOptions = [];
foreach ($imprints as $imprint) {
$imprintOptions[] = [
'value' => $imprint['imprintId'],
Expand Down Expand Up @@ -80,7 +80,8 @@ public function __construct($action, $imprints, $errors)
'label' => __('plugins.generic.thoth.imprint'),
'options' => $imprintOptions,
'required' => true,
'groupId' => 'default'
'groupId' => 'default',
'value' => $imprints[0]['imprintId'] ?? null
]));
}

Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<version>
<application>thoth</application>
<type>plugins.generic</type>
<release>0.2.1.2</release>
<date>2024-10-21</date>
<release>0.2.1.3</release>
<date>2024-10-22</date>
<lazy-load>1</lazy-load>
<class>ThothPlugin</class>
</version>

0 comments on commit c64d302

Please sign in to comment.