Skip to content

Commit d8204a3

Browse files
committed
Add main contribution field to contributor form
Issue: documentacao-e-tarefas/desenvolvimento_e_infra#994 Signed-off-by: Thiago Brasil <thiago@lepidus.com.br>
1 parent 0724925 commit d8204a3

5 files changed

Lines changed: 61 additions & 0 deletions

File tree

ThothPlugin.inc.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import('plugins.generic.thoth.classes.api.ThothEndpoint');
2525
import('plugins.generic.thoth.classes.components.forms.config.CatalogEntryFormConfig');
2626
import('plugins.generic.thoth.classes.components.forms.config.PublishFormConfig');
27+
import('plugins.generic.thoth.classes.components.forms.config.ContributorFormConfig');
2728
import('plugins.generic.thoth.classes.templateFilters.ThothSectionTemplateFilter');
2829
import('plugins.generic.thoth.classes.listeners.PublicationEditListener');
2930
import('plugins.generic.thoth.classes.listeners.PublicationPublishListener');
@@ -161,6 +162,9 @@ public function addFormConfig()
161162

162163
$catalogEntryFormConfig = new CatalogEntryFormConfig();
163164
HookRegistry::register('Form::config::before', [$catalogEntryFormConfig, 'addConfig']);
165+
166+
$contributorFormConfig = new ContributorFormConfig();
167+
HookRegistry::register('Form::config::before', [$contributorFormConfig, 'addConfig']);
164168
}
165169

166170
public function addListeners()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/**
4+
* @file plugins/generic/thoth/classes/components/forms/config/ContributorFormConfig.inc.php
5+
*
6+
* Copyright (c) 2024-2025 Lepidus Tecnologia
7+
* Copyright (c) 2024-2025 Thoth
8+
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
9+
*
10+
* @class ContributorFormConfig
11+
* @ingroup plugins_generic_thoth
12+
*
13+
* @brief Thoth configuration for contributor form
14+
*/
15+
16+
use APP\facades\Repo;
17+
18+
class ContributorFormConfig
19+
{
20+
public function addConfig($hookName, $form)
21+
{
22+
if ($form->id !== 'contributor' || !empty($form->errors)) {
23+
return;
24+
}
25+
26+
$form->addField(new \PKP\components\forms\FieldOptions('mainContribution', [
27+
'label' => __('plugins.generic.thoth.field.mainContribution'),
28+
'value' => false,
29+
'options' => [
30+
[
31+
'value' => true,
32+
'label' => __('plugins.generic.thoth.field.mainContribution.label'),
33+
],
34+
],
35+
]));
36+
37+
return false;
38+
}
39+
}

locale/en/locale.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ msgstr "Page Count"
4040
msgid "plugins.generic.thoth.field.imageCount.label"
4141
msgstr "Image Count"
4242

43+
msgid "plugins.generic.thoth.field.mainContribution"
44+
msgstr "Thoth Main Contribution"
45+
46+
msgid "plugins.generic.thoth.field.mainContribution.label"
47+
msgstr "Identify this contributor as main contribution in Thoth."
48+
4349
msgid "plugins.generic.thoth.workType"
4450
msgstr "Work Type"
4551

locale/es/locale.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ msgstr "Número de Páginas"
4040
msgid "plugins.generic.thoth.field.imageCount.label"
4141
msgstr "Número de Imágenes"
4242

43+
msgid "plugins.generic.thoth.field.mainContribution"
44+
msgstr "Colaboración Principal de Thoth"
45+
46+
msgid "plugins.generic.thoth.field.mainContribution.label"
47+
msgstr "Identificar a este colaborador como colaboración principal en Thoth."
48+
4349
msgid "plugins.generic.thoth.workType"
4450
msgstr "Tipo de Trabajo"
4551

locale/pt_BR/locale.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ msgstr "Número de Páginas"
4040
msgid "plugins.generic.thoth.field.imageCount.label"
4141
msgstr "Número de Imagens"
4242

43+
msgid "plugins.generic.thoth.field.mainContribution"
44+
msgstr "Contribuição Principal do Thoth"
45+
46+
msgid "plugins.generic.thoth.field.mainContribution.label"
47+
msgstr "Identificar este contribuidor como contribuição principal em Thoth."
48+
4349
msgid "plugins.generic.thoth.workType"
4450
msgstr "Tipo de Trabalho"
4551

0 commit comments

Comments
 (0)