Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Nov 6, 2024
1 parent e818859 commit 9b74cd6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class BasicAttributeCollectorsTable extends Table {
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\LayoutTrait;

/**
* Perform Cake Model initialization.
Expand Down
19 changes: 8 additions & 11 deletions app/plugins/CoreEnroller/templates/element/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
default => ''
};

// If we are re-rendering the Petition override the default value with whatever
// If we are re-rendering the Petition, override the default value with whatever
// was previously saved
if(!empty($vv_petition_attributes)) {
$curEntity = $vv_petition_attributes->firstMatch(['enrollment_attribute_id' => $attr->id]);
Expand Down Expand Up @@ -97,14 +97,11 @@
// Set the final fieldOptions
$formArguments['fieldOptions'] = $options;

// HIDDEN Field
// We print directly, we do not delegate to the element for further processing
if ($attr->hidden) {
print match(true) {
// HIDDEN Field
// We print directly, we do not delegate to the element for further processing
// In case this is a hidden field, we need to get only the value
print $this->Form->hidden($formArguments['fieldName'], ['value' => $options['default']]);
} else {
// Print the element
print $this->element('form/listItem', [
'arguments' => $formArguments
]);
}
$attr->hidden =>$this->Form->hidden($formArguments['fieldName'], ['value' => $options['default']]),
// Default use case
default => $this->element('form/listItem', ['arguments' => $formArguments])
};
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

<div class="fieldset-field">
<label for="<?= $field ?>"><?= $label ?></label>
<!-- --><?php //= \in_array($field, $required_fields_list, true) ? $this->element('form/requiredSpan') : ''?>
<?= $isRequiredFromValidationRule ? $this->element('form/requiredSpan') : ''?>
<div class="input text">
<?= $this->Field->formField(...$formArguments) ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
}

$permitted_fields_list_flipped = array_flip($permitted_fields_list);

?>

<?php foreach($groupedFieldsArray as $idx => $fields): ?>
Expand Down
4 changes: 4 additions & 0 deletions app/src/View/Helper/FieldHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ public function calculateLiClasses(): string
$classes .= 'fields-people-autocomplete ';
}

// Each field should have a class like `fields-<name of the field>`
$field = $vv_field_arguments['fieldNameAlias'] ?? $fieldName ?? 'unknown';
$classes .= " fields-$field";

return $classes;
}

Expand Down

0 comments on commit 9b74cd6

Please sign in to comment.