1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 07:47:00 +02:00
This commit is contained in:
Ryan Cramer
2016-12-26 11:10:09 -05:00
parent b6ba7049a0
commit 20b6ebb81f

View File

@@ -431,8 +431,18 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
if($itemID) break;
}
// create a new/blank item to be used as a template for any new items added
if(!$itemID) {
if($itemID) {
// only rendering a single item, ajax mode
foreach($form->getAll() as $inputfield) {
$idAttr = $inputfield->attr('id');
$inputfield->renderReady($form, $this->renderValueMode);
$jsValue = $this->wire('config')->js($idAttr);
if(!empty($jsValue)) {
$inputfield->appendMarkup .= "<script>ProcessWire.config['$idAttr'] = " . json_encode($jsValue) . ';</script>';
}
}
} else {
// create a new/blank item to be used as a template for any new items added
/** @var InputfieldWrapper $wrap */
$wrap = $this->wire('modules')->get('InputfieldFieldset');
$wrap->label = $this->renderRepeaterLabel($label, ++$cnt, new NullPage());