diff --git a/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc b/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc index eb158621e..2fe713d4d 100644 --- a/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc +++ b/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc @@ -25,7 +25,7 @@ * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) */ -// This view does currently not support read-only -if($vv_action == 'add' || $vv_action == 'edit') { -// XXX Placeholder -} +// Currently this Configuration View has no fields + +$this->Field->disableFormEditMode(); + diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index 70e1d8324..818fd307d 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -43,7 +43,6 @@ class FieldHelper extends Helper { */ public const EDITABLE_ACTIONS = [ 'add', 'edit', // CRUD actions - 'start' // ENROLLMENT FLOW actions ]; // Is this read-only or read-write? @@ -82,7 +81,8 @@ 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, self::EDITABLE_ACTIONS, true); + $vv_is_editable = filter_var($this->getView()->get('vv_is_editable'), FILTER_VALIDATE_BOOLEAN); + $this->editable = \in_array($this->action, self::EDITABLE_ACTIONS, true) || $vv_is_editable; $this->pluginName = $this->getView()->getPlugin(); $this->entity = $this->getView()->get('vv_obj'); $this->fieldTypes = $this->getView()->get('vv_field_types'); @@ -464,6 +464,28 @@ public function isEditable(): bool return $this->editable; } + /** + * Enable Form Edit mode. This will allow fields to be editable + * and the submit button will be rendered + * + * @return void + */ + public function enableFormEditMode(): void + { + $this->editable = true; + } + + /** + * Disable Form's edit mode. Fields will be become readonly/disabled + * and the submit button will be removed from the DOM + * + * @return void + */ + public function disableFormEditMode(): void + { + $this->editable = false; + } + /** * @param string $field * diff --git a/app/templates/EnrollmentFlows/start.php b/app/templates/EnrollmentFlows/start.php index 89cb1acc2..d6b5f5017 100644 --- a/app/templates/EnrollmentFlows/start.php +++ b/app/templates/EnrollmentFlows/start.php @@ -29,6 +29,8 @@ // Enrollment Flow Start has its own file of fields $this->set('vv_fields_inc', 'start.inc'); +// Set form edit ability +$this->set('vv_is_editable', true); // Create the Form print $this->Form->create();