Skip to content

Commit 716697b

Browse files
authored
submission form - align ux of mandatory CODECHECK (#140)
Closes #128; When not opted-in, it now looks like this: <img width="508" height="91" alt="Image" src="https://github.com/user-attachments/assets/51a23cf2-e9ef-4b5e-8b0b-231ba67c783b" /> When opted-in it looks like this: <img width="513" height="94" alt="Image" src="https://github.com/user-attachments/assets/075e0267-5937-49df-a9ff-75b90337f000" /> When mandatory it looks like this: <img width="519" height="127" alt="Image" src="https://github.com/user-attachments/assets/913df20e-d47b-4c44-905d-229f9cc91af0" />
2 parents bc38a71 + 4e34e21 commit 716697b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

CodecheckPlugin.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public function addOptInCheckbox(string $hookName, \PKP\components\forms\FormCom
334334
$codecheckMode = $this->getSetting($context->getId(), Constants::CODECHECK_MODE);
335335
CodecheckLogger::debug('Mode: ' . $codecheckMode);
336336
$checkboxValue = false;
337-
$checkboxDisabled = false;
337+
$codecheckMandatory = false;
338338
$codecheckDescription = __('plugins.generic.codecheck.optIn.description', [
339339
'codecheckLink' => "<a href='{$this->getUrlPageRoute("codecheck")}/info' target='_blank'>" . __('plugins.generic.codecheck.displayName') . "</a>"
340340
]);
@@ -343,27 +343,26 @@ public function addOptInCheckbox(string $hookName, \PKP\components\forms\FormCom
343343
$checkboxValue = true;
344344
} elseif ($codecheckMode == 'mandatory') {
345345
$checkboxValue = true;
346-
$checkboxDisabled = true;
346+
$codecheckMandatory = true;
347347
$codecheckDescription = __('plugins.generic.codecheck.mandatory.description', [
348348
'codecheckLink' => "<a href='{$this->getUrlPageRoute("codecheck")}/info' target='_blank'>" . __('plugins.generic.codecheck.displayName') . "</a>"
349349
]);
350350
}
351351

352352
$form->addField(new FieldOptions('codecheckOptIn', [
353353
'label' => __('plugins.generic.codecheck.displayName'),
354+
'isRequired' => $codecheckMandatory,
354355
'type' => 'checkbox',
355356
'options' => [
356357
[
357358
'value' => 1,
358359
'label' => $codecheckDescription,
359-
'disabled' => $checkboxDisabled,
360+
'disabled' => $codecheckMandatory,
360361
]
361362
],
362363
'value' => $checkboxValue,
363364
'groupId' => 'default'
364365
]));
365-
366-
return false;
367366
}
368367

369368
return false;

0 commit comments

Comments
 (0)