|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @file plugins/generic/thoth/classes/components/forms/config/CatalogEntryFormConfig.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 CatalogEntryFormConfig |
| 11 | + * @ingroup plugins_generic_thoth |
| 12 | + * |
| 13 | + * @brief Thoth config for catalog entry form |
| 14 | + */ |
| 15 | + |
| 16 | +class CatalogEntryFormConfig |
| 17 | +{ |
| 18 | + public function addConfig($hookName, $form) |
| 19 | + { |
| 20 | + if ($form->id !== 'catalogEntry' || !empty($form->errors)) { |
| 21 | + return; |
| 22 | + } |
| 23 | + |
| 24 | + $actionParts = explode('/', $form->action); |
| 25 | + $publicationId = end($actionParts); |
| 26 | + $publication = Services::get('publication')->get($publicationId); |
| 27 | + |
| 28 | + $form->addField(new \PKP\components\forms\FieldText('place', [ |
| 29 | + 'label' => __('plugins.generic.thoth.field.place.label'), |
| 30 | + 'value' => $publication->getData('place'), |
| 31 | + ])) |
| 32 | + ->addField(new \PKP\components\forms\FieldText('pageCount', [ |
| 33 | + 'label' => __('plugins.generic.thoth.field.pageCount.label'), |
| 34 | + 'value' => $publication->getData('pageCount'), |
| 35 | + ])) |
| 36 | + ->addField(new \PKP\components\forms\FieldText('imageCount', [ |
| 37 | + 'label' => __('plugins.generic.thoth.field.imageCount.label'), |
| 38 | + 'value' => $publication->getData('imageCount'), |
| 39 | + ])); |
| 40 | + |
| 41 | + return false; |
| 42 | + } |
| 43 | +} |
0 commit comments