Commit 4aa9a901 authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm.php: #3399 templateGroup: Hide 'add' if limit is reached.

parent a87bdff3
......@@ -2875,6 +2875,7 @@ abstract class AbstractBuildForm {
// save parent processed FE's
$feSpecNativeSave = $this->feSpecNative;
$addButtonId = 'add_button_' . $formElement[FE_ID];
$qfqFieldsName = 'qfq_fields_' . $formElement[FE_ID]; // ='qfq-fields'
$templateName = 'template_' . $formElement[FE_ID]; // ='template'
$targetName = 'target_' . $formElement[FE_ID]; // ='template'
......@@ -2894,7 +2895,7 @@ abstract class AbstractBuildForm {
EOT;
$htmlAdd = <<<EOT
<button type="button" class="$addClass" onclick="QfqNS.addFields('#$templateName', '#$targetName', $max)">$addText</button>
<button type="button" id="$addButtonId" class="$addClass" onclick="QfqNS.addFields('#$templateName', '#$targetName', $max)">$addText</button>
EOT;
$htmlDelete = <<<EOT
......@@ -2920,6 +2921,7 @@ EOT;
$attribute = Support::doAttribute('class', $qfqFieldsName);
$attribute .= Support::doAttribute('id', $targetName);
$attribute .= Support::doAttribute('data-qfq-line-template', '#' . $templateName);
$attribute .= Support::doAttribute('data-qfq-line-add-button', '#' . $addButtonId);
// Element where the effective FormElements will be copied to. The BS 'col-md-* Classes are inside the template, not here. This here should be pure data without wrapping.
$html = Support::wrapTag("<div $attribute>", $html, false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment