public function PasswordPolicyConstraintForm::renderRows in Password Policy 8.3
Helper function to render the constraint rows for the policy.
Parameters
array $cached_values: Loading the cached metadata for the form wizard.
Return value
array Constraint rows rendered for the policy.
1 call to PasswordPolicyConstraintForm::renderRows()
- PasswordPolicyConstraintForm::buildForm in src/
Form/ PasswordPolicyConstraintForm.php - Form constructor.
File
- src/
Form/ PasswordPolicyConstraintForm.php, line 167
Class
- PasswordPolicyConstraintForm
- Form that lists out the constraints for the policy.
Namespace
Drupal\password_policy\FormCode
public function renderRows(array $cached_values) {
/** @var \Drupal\password_policy\Entity\PasswordPolicy $policy */
$policy = $cached_values['password_policy'];
$configured_conditions = [];
foreach ($policy
->getConstraints() as $row => $constraint) {
/** @var \Drupal\password_policy\PasswordConstraintInterface $instance */
$instance = $this->manager
->createInstance($constraint['id'], $constraint);
$operations = $this
->getOperations('entity.password_policy.constraint', [
'machine_name' => $cached_values['id'],
'constraint_id' => $row,
]);
$build = [
'#type' => 'operations',
'#links' => $operations,
];
$configured_conditions[] = [
'plugin_id' => $instance
->getPluginId(),
'summary' => $instance
->getSummary(),
'operations' => [
'data' => $build,
],
];
}
return $configured_conditions;
}