From 7be2d7d11f9c6178fe9515d0d4d8ba8da168ed0f Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Fri, 27 Sep 2024 10:31:50 +0300 Subject: [PATCH] Fix EnrollmentFlow broken start view. Fix petitions view. --- app/src/View/Helper/FieldHelper.php | 10 ++- app/templates/EnrollmentFlows/fields.inc | 3 + app/templates/EnrollmentFlows/start.inc | 51 +++++++++++ app/templates/EnrollmentFlows/start.php | 26 ++---- app/templates/Petitions/fields.inc | 106 +++++++++++------------ 5 files changed, 122 insertions(+), 74 deletions(-) create mode 100644 app/templates/EnrollmentFlows/start.inc diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index ca2fa9431..70e1d8324 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -38,6 +38,14 @@ class FieldHelper extends Helper { public $helpers = ['Form', 'Html']; + /** + * List of predefined editable form actions + */ + public const EDITABLE_ACTIONS = [ + 'add', 'edit', // CRUD actions + 'start' // ENROLLMENT FLOW actions + ]; + // Is this read-only or read-write? protected bool $editable = true; @@ -74,7 +82,7 @@ public function initialize(array $config): void $this->reqFields = $this->getView()->get('vv_required_fields'); $this->modelName = $this->getView()->getName(); $this->action = $this->getView()->get('vv_action'); - $this->editable = \in_array($this->action, ['add', 'edit']); + $this->editable = \in_array($this->action, self::EDITABLE_ACTIONS, true); $this->pluginName = $this->getView()->getPlugin(); $this->entity = $this->getView()->get('vv_obj'); $this->fieldTypes = $this->getView()->get('vv_field_types'); diff --git a/app/templates/EnrollmentFlows/fields.inc b/app/templates/EnrollmentFlows/fields.inc index d4fac9f50..df72eb6b5 100644 --- a/app/templates/EnrollmentFlows/fields.inc +++ b/app/templates/EnrollmentFlows/fields.inc @@ -24,6 +24,9 @@ * @since COmanage Registry v5.0.0 * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) */ + +declare(strict_types = 1); + ?>