Skip to content

Commit c5136f0

Browse files
ynamiteskerbis
authored andcommitted
Update MFormParser.php to esacpe values with single & double quotes
Added `htmlspecialchars(json_encode($itemValue), ENT_QUOTES, 'UTF-8')` to support or rather esacpe values containing single and/or double quotes.
1 parent 564941a commit c5136f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/MForm/Parser/MFormParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function openRepeaterElement(MFormItem $item, string $key, array $items)
105105
$confirm .= (isset($item->getAttributes()['confirm_delete_msg'])) ? ', \''.$item->getAttributes()['confirm_delete_msg'] .'\'' : ', \''.rex_i18n::msg('mform_repeater_remove_group_confirm_msg').'\'';
106106
$addInitGroup = ($open) ? ' if('.$groups.'.length <= 0) { addGroup('.$obj.') };' : '';
107107

108-
$output[] = '<section class="repeater" id="'.$repeaterId.'"><div x-data="repeater()" x-repeater @repeater:ready.once=\'setInitialValue('.json_encode($itemValue).');'.$addInitGroup.'\' @selectcustomlink.window="selectCustomLink($event.detail)" id="x-repeater">';
108+
$output[] = '<section class="repeater" id="'.$repeaterId.'"><div x-data="repeater()" x-repeater @repeater:ready.once=\'setInitialValue('.htmlspecialchars(json_encode($itemValue), ENT_QUOTES, 'UTF-8').');'.$addInitGroup.'\' @selectcustomlink.window="selectCustomLink($event.detail)" id="x-repeater">';
109109
// add button
110110
$output[] = '<template x-if="'.$groups.'.length <= 0"><a href="#" type="button" class="btn btn-mform-repeater '.$btnClass.'" @click.prevent=\'addGroup('.$obj.')\'><i class="rex-icon fa-plus-circle"></i> '.((!empty($buttonName))?$buttonName:'Add group').'</a></template>';
111111
$header = '

0 commit comments

Comments
 (0)