diff --git a/app/plugins/CoreEnroller/src/Controller/AttributeCollectorsController.php b/app/plugins/CoreEnroller/src/Controller/AttributeCollectorsController.php index 7665edb2d..7e1631bd3 100644 --- a/app/plugins/CoreEnroller/src/Controller/AttributeCollectorsController.php +++ b/app/plugins/CoreEnroller/src/Controller/AttributeCollectorsController.php @@ -121,23 +121,4 @@ public function dispatch(string $id) { $this->render('/Standard/dispatch'); } - - /** - * Display information about this Step. - * - * @since COmanage Registry v5.1.0 - * @param string $id Attribute Collector ID - */ - - public function display(string $id): void { - $petition = $this->getPetition(); - - $this->set('vv_petition_attributes', - $this->AttributeCollectors - ->EnrollmentAttributes - ->PetitionAttributes - ->find() - ->where(['petition_id' => $petition->id]) - ->all()); - } } diff --git a/app/plugins/CoreEnroller/src/Controller/BasicAttributeCollectorsController.php b/app/plugins/CoreEnroller/src/Controller/BasicAttributeCollectorsController.php index bf3f701f8..01890e70f 100644 --- a/app/plugins/CoreEnroller/src/Controller/BasicAttributeCollectorsController.php +++ b/app/plugins/CoreEnroller/src/Controller/BasicAttributeCollectorsController.php @@ -87,21 +87,4 @@ public function dispatch(string $id) { $this->render('/Standard/dispatch'); } - - /** - * Display information about this Step. - * - * @since COmanage Registry v5.1.0 - * @param string $id Attribute Collector ID - */ - - public function display(string $id) { - $petition = $this->getPetition(); - - $this->set('vv_petition_basic_attribute_set', $this->BasicAttributeCollectors - ->PetitionBasicAttributeSets - ->find() - ->where(['PetitionBasicAttributeSets.petition_id' => $petition->id]) - ->firstOrFail()); - } } diff --git a/app/plugins/CoreEnroller/templates/AttributeCollectors/display.php b/app/plugins/CoreEnroller/templates/AttributeCollectors/display.php deleted file mode 100644 index f25efb457..000000000 --- a/app/plugins/CoreEnroller/templates/AttributeCollectors/display.php +++ /dev/null @@ -1,8 +0,0 @@ -toArray(); -?> - diff --git a/app/plugins/CoreEnroller/templates/BasicAttributeCollectors/display.php b/app/plugins/CoreEnroller/templates/BasicAttributeCollectors/display.php deleted file mode 100644 index 4247e7400..000000000 --- a/app/plugins/CoreEnroller/templates/BasicAttributeCollectors/display.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/app/templates/element/petition/enrollmentFlowSteps/attributeCollectorsStep.php b/app/plugins/CoreEnroller/templates/element/petition/attributeCollectorsStep.php similarity index 100% rename from app/templates/element/petition/enrollmentFlowSteps/attributeCollectorsStep.php rename to app/plugins/CoreEnroller/templates/element/petition/attributeCollectorsStep.php diff --git a/app/templates/element/petition/enrollmentFlowStep.php b/app/plugins/CoreEnroller/templates/element/petition/basicAttributeCollectorsStep.php similarity index 55% rename from app/templates/element/petition/enrollmentFlowStep.php rename to app/plugins/CoreEnroller/templates/element/petition/basicAttributeCollectorsStep.php index afc898b70..925999d9a 100644 --- a/app/templates/element/petition/enrollmentFlowStep.php +++ b/app/plugins/CoreEnroller/templates/element/petition/basicAttributeCollectorsStep.php @@ -1,6 +1,6 @@ id === null) { + return __d('error', 'notfound', 'Petition Attributes'); + } -$parsePluginName = explode('.', $vv_step->plugin); -$modelName = array_pop($parsePluginName); -$elementName = lcfirst($modelName) . 'Step'; + $tableObj = $this->Petition->getTable('PetitionBasicAttributeSets'); + $vv_petition_basic_attribute_set = $tableObj->find() + ->where(['PetitionBasicAttributeSets.petition_id' => $vv_obj->id]) + ->firstOrFail(); +?> -// The convention is that the element name for each step is the name of the EnrollmentFlow Step model followed by -// the word Step -print $this->element("petition/enrollmentFlowSteps/$elementName", ['vv_step' => $vv_step]); + diff --git a/app/src/Model/Table/PetitionsTable.php b/app/src/Model/Table/PetitionsTable.php index e999b7d80..065ab20ef 100644 --- a/app/src/Model/Table/PetitionsTable.php +++ b/app/src/Model/Table/PetitionsTable.php @@ -90,7 +90,7 @@ public function initialize(array $config): void { $this->hasMany('PetitionStepResults') ->setDependent(true) ->setCascadeCallbacks(true); - $this->hasMany('PetitionAttributes') + $this->hasMany('CoreEnroller.PetitionAttributes') ->setDependent(true) ->setCascadeCallbacks(true); diff --git a/app/src/View/Helper/PetitionHelper.php b/app/src/View/Helper/PetitionHelper.php index a23edf2e0..be426a30d 100644 --- a/app/src/View/Helper/PetitionHelper.php +++ b/app/src/View/Helper/PetitionHelper.php @@ -83,7 +83,7 @@ public function populateAutoViewVars(): void } /** - * Get the table validation rules + * Get reference to the Table Object * * @param string $tableName * diff --git a/app/templates/Petitions/fields.inc b/app/templates/Petitions/fields.inc index a0a0cb007..ee38c5183 100644 --- a/app/templates/Petitions/fields.inc +++ b/app/templates/Petitions/fields.inc @@ -256,10 +256,13 @@ if (!empty($vv_obj?->petitioner_person?->id)) {
  • -

    - -

    - element('petition/enrollmentFlowStep', ['vv_step' => $step])?> +

    plugin ?>

    + plugin); + $elementName = lcfirst($pluginClass) . 'Step'; + + print $this->element("$pluginName.petition/$elementName", ['vv_step' => $step]); + ?>