fix: [element:generic_index] Toggle field passes expected data format

pull/37/head
mokaddem 2021-01-18 08:51:16 +01:00
parent 13c8f3f7c5
commit c70ce5170f
2 changed files with 18 additions and 17 deletions

View File

@ -59,18 +59,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
__('Only one template per scope can be set as the default template'),
'{{0}}',
]),
'type' => [
'function' => function($row, $data) {
$conflictingTemplate = getConflictingTemplate($row, $data);
if (!empty($conflictingTemplate)) {
return 'confirm-danger';
}
return 'confirm-warning';
},
'data' => [
'defaultTemplatePerScope' => $defaultTemplatePerScope
]
],
'type' => '{{0}}',
'confirmText' => __('Yes, set as default'),
'arguments' => [
'titleHtml' => ['name'],
@ -99,6 +88,18 @@ echo $this->element('genericElements/IndexTable/index_table', [
'defaultTemplatePerScope' => $defaultTemplatePerScope
]
]
],
'type' => [
'function' => function($row, $data) {
$conflictingTemplate = getConflictingTemplate($row, $data);
if (!empty($conflictingTemplate)) {
return 'confirm-danger';
}
return 'confirm-warning';
},
'data' => [
'defaultTemplatePerScope' => $defaultTemplatePerScope
]
]
]
],
@ -106,7 +107,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
'titleHtml' => __('Remove {{0}} as the default template?'),
'type' => 'confirm-warning',
'confirmText' => __('Yes, do not set as default'),
'arguements' => [
'arguments' => [
'titleHtml' => ['name'],
]
]

View File

@ -50,10 +50,10 @@
unset($stringArrayEnable['arguments']);
$stringArrayDisable = $field['toggle_data']['confirm']['disable'];
unset($stringArrayDisable['arguments']);
$confirmOptions = array_merge(
$this->DataFromPath->buildStringsInArray($stringArrayEnable, $row, $field['toggle_data']['confirm']['enable']['arguments'], ['highlight' => true]),
$this->DataFromPath->buildStringsInArray($stringArrayDisable, $row, $field['toggle_data']['confirm']['disable']['arguments'], ['highlight' => true]),
);
$confirmOptions = [
'enable' => $this->DataFromPath->buildStringsInArray($stringArrayEnable, $row, $field['toggle_data']['confirm']['enable']['arguments'], ['highlight' => true]),
'disable' => $this->DataFromPath->buildStringsInArray($stringArrayDisable, $row, $field['toggle_data']['confirm']['disable']['arguments'], ['highlight' => true]),
];
}
$url = $this->DataFromPath->buildStringFromDataPath($field['url'], $row, $field['url_params_vars']);
?>