Skip to content

CFM-475_plus_review_changes #341

Merged
merged 3 commits into from
Sep 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ class AttributeCollectorsController extends StandardEnrollerController {
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->AttributeCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->AttributeCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->AttributeCollectors->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,6 @@ class BasicAttributeCollectorsController extends StandardEnrollerController {
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.1.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->BasicAttributeCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->BasicAttributeCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->BasicAttributeCollectors->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ class EmailVerifiersController extends StandardEnrollerController {
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->EmailVerifiers->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->EmailVerifiers->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->EmailVerifiers->EnrollmentFlowSteps->getPrimaryKey());
}

// We use the viewvar to determine the op since 'index' isn't always present
$op = $this->viewBuilder()->getVar('vv_op');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ class EnrollmentAttributesController extends StandardEnrollerController {
public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_supported_attributes', $this->EnrollmentAttributes->supportedAttributes());

$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->EnrollmentAttributes->AttributeCollectors->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->EnrollmentAttributes->AttributeCollectors->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->EnrollmentAttributes->AttributeCollectors->getPrimaryKey());
}

$ret = parent::beforeRender($event);

$attributes = $this->viewBuilder()->getVar('attributes');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,6 @@ class IdentifierCollectorsController extends StandardEnrollerController {
'IdentifierCollectors.id' => 'asc'
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->IdentifierCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->IdentifierCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->IdentifierCollectors->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,6 @@ class InvitationAcceptersController extends StandardEnrollerController {
'InvitationAccepters.id' => 'asc'
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->InvitationAccepters->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->InvitationAccepters->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->InvitationAccepters->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
Expand Down
1 change: 0 additions & 1 deletion app/src/Controller/Component/RegistryAuthComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

namespace App\Controller\Component;

use App\Model\Entity;
use \App\Lib\Enum\AuthenticationEventEnum;
use \App\Lib\Enum\SuspendableStatusEnum;
use \App\Lib\Enum\TemplateableStatusEnum;
Expand Down
11 changes: 11 additions & 0 deletions app/src/Controller/StandardEnrollerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_petition', null);
}

$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$currentTable = $this->getCurrentTable();
$efsTable = $currentTable->getAssociation('EnrollmentFlowSteps')->getTarget();

$this->set('vv_bc_parent_obj', $efsTable->get($link->value));
$this->set('vv_bc_parent_displayfield', $efsTable->getDisplayField());
$this->set('vv_bc_parent_primarykey', $efsTable->getPrimaryKey());
}

return parent::beforeRender($event);
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/Lib/Util/StringUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static function columnKey(

// Otherwise look for the general key
$cfield = __d('field', $c);
return ($cfield !== $c) ? $cfield : \Cake\Utility\Inflector::humanize($c);
return ($cfield !== $c) ? $cfield : Inflector::humanize($c);
}

/**
Expand Down Expand Up @@ -188,7 +188,7 @@ public static function pluginToTextDomain(?string $plugin): string
if (empty($plugin)) {
return 'operation';
}
return \Cake\Utility\Inflector::singularize(\Cake\Utility\Inflector::tableize($plugin));
return Inflector::underscore($plugin);
}

/**
Expand Down Expand Up @@ -407,7 +407,7 @@ public static function localizeController(string $controllerName, ?string $plugi

if ($pluginName) {
// Localize via plugin
return __d(\Cake\Utility\Inflector::underscore($pluginName), 'controller.' . $controllerName, [$plural ? 99 : 1]);
return __d(Inflector::underscore($pluginName), 'controller.' . $controllerName, [$plural ? 99 : 1]);
}
// Standard Localization
return __d('controller', $controllerName, [$plural ? 99 : 1]);
Expand Down
4 changes: 1 addition & 3 deletions app/src/View/Helper/FieldHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ public function calculateLabelAndDescription(string $fieldName): array
$label = null;

// First, try to autogenerate the field label (if we weren't given one).
$pluginDomain = (!empty($this->getPluginName())
? Inflector::underscore($this->getPluginName())
: null);
$pluginDomain = StringUtilities::pluginToTextDomain($this->getPluginName());

$modelName = $this->getModelName();
// We try to automagically determine if a description for the field exists by
Expand Down