Skip to content

Commit

Permalink
Refactor clonable fields for configuration-only approach (CFM-218)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Nov 13, 2025
1 parent 9bd9f99 commit 11829dd
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 23 deletions.
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/field.po
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ msgstr "Revision"
msgid "children"
msgstr "Children"

msgid "cloning"
msgstr "Cloning"

msgid "code"
msgstr "Code"

Expand Down
3 changes: 1 addition & 2 deletions app/templates/ApiUsers/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ if($vv_cur_co->isCOmanageCO()) {
$banners = [
__d('information', 'api.cmp')
];
}
}

// We link to the "Generate" button on edit only
Expand Down Expand Up @@ -65,4 +64,4 @@ $fields = [
'privileged', // boolean
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));
2 changes: 1 addition & 1 deletion app/templates/Cous/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ if(!empty($parents)) {
];
}

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));
2 changes: 1 addition & 1 deletion app/templates/ExternalIdentitySources/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $fields = [
'suppress_noop_logs'
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));

// Top Links
$topLinks = [
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Groups/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if($vv_action != 'add') {
}
}

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));

// List the MVEAs that may be shown on the mveaCanvas
// When this array exists, the mveaCanvas.php element will render
Expand Down
2 changes: 1 addition & 1 deletion app/templates/IdentifierAssignments/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $fields = [
'ordr'
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));
?>

<script>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Pipelines/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $fields = [
// XXX Connections
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));

// Top Links
$topLinks[] = [
Expand Down
2 changes: 1 addition & 1 deletion app/templates/ProvisioningTargets/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $fields = [
'ordr'
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));

$subnav = [
'name' => 'plugin',
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Servers/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ $fields = [
]
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

foreach(['uuid',
'cri',
'do_not_clone'] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
return [
'clonable' => [
'fieldLabel' => __d('field','cloning'),
'labelIsTextOnly' => true,
'groupedControls' => [
'uuid' => [
'singleRowItem' => true,
'label' => __d('field','uuid'),
'type' => 'text'
],
'cri' => [
'singleRowItem' => true,
'label' => __d('field','cri')
],
'do_not_clone' => [
'singleRowItem' => true,
'label' => __d('field','do_not_clone')
]
]
]);
}
]
];
2 changes: 1 addition & 1 deletion app/templates/Types/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $fields = [
'edupersonaffiliation'
];

print $this->element('clonable');
$fields = array_merge($fields, include(ROOT . DS . 'templates' . DS . 'Standard/clonable.inc'));
?>

<script>
Expand Down
8 changes: 3 additions & 5 deletions app/templates/element/form/infoDiv/grouped.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/


declare(strict_types = 1);

$classes = '';

$blockClass = '';

?>

Expand All @@ -39,12 +37,12 @@
$fieldArguments = $this->Field->restructureFieldArguments($fieldArguments);

if(isset($fieldArguments['singleRowItem']) && $fieldArguments['singleRowItem']) {
$classes .= 'd-block ';
$blockClass = ' d-block';
// This configuration is not needed for the control construction
unset($fieldArguments['singleRowItem']);
}
?>
<div class="subfield subfield-cols <?= $classes ?>">
<div class="subfield subfield-cols<?= $blockClass ?>">
<div class="field-col">
<?= $this->Field->formField($fieldName, ...$fieldArguments) ?>
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,12 @@ ul.form-list .subfield-title {
ul.form-list .subfield-cols {
display: inline-flex;
}
ul.form-list .subfield-cols.d-block {
margin-top: 0.5rem;
}
ul.form-list .subfield-cols.d-block:first-child {
margin-top: 0;
}
ul.form-list .field-col .subfield-title {
display: block;
margin-bottom: 0;
Expand Down

0 comments on commit 11829dd

Please sign in to comment.