From c01943d70c887edb1ffdcf8353cc3b54742d331c Mon Sep 17 00:00:00 2001
From: Carsten  Rose <carsten.rose@math.uzh.ch>
Date: Tue, 7 Mar 2017 21:45:33 +0100
Subject: [PATCH] AbstractBuildForm.php: for dynamicUpdate wrap 'label' in the
 regular ''<label for=..>'' tag.

---
 extension/qfq/qfq/AbstractBuildForm.php | 34 ++++++++++++-------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php
index a5777185e..686236080 100644
--- a/extension/qfq/qfq/AbstractBuildForm.php
+++ b/extension/qfq/qfq/AbstractBuildForm.php
@@ -599,7 +599,7 @@ abstract class AbstractBuildForm {
 
         if (isset($formElement[FE_LABEL])) {
             $key = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL;
-            $json[API_ELEMENT_UPDATE][$key][API_ELEMENT_CONTENT] = $formElement[FE_LABEL];
+            $json[API_ELEMENT_UPDATE][$key][API_ELEMENT_CONTENT] = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL]);
         }
 
         if (isset($formElement[FE_NOTE])) {
@@ -656,6 +656,22 @@ abstract class AbstractBuildForm {
         }
     }
 
+    /**
+     * Builds a label, typically for an html-'<input>'-element.
+     *
+     * @param string $htmlFormElementName
+     * @param string $label
+     * @return string
+     */
+    public function buildLabel($htmlFormElementName, $label) {
+        $attributes = Support::doAttribute('for', $htmlFormElementName);
+        $attributes .= Support::doAttribute('class', 'control-label');
+
+        $html = Support::wrapTag("<label $attributes>", $label);
+
+        return $html;
+    }
+
     /**
      * Takes the current SIP ('form' and additional parameter), set SIP_RECORD_ID=0 and create a new 'NewRecordUrl'.
      *
@@ -691,22 +707,6 @@ abstract class AbstractBuildForm {
 
     abstract public function buildRowSubrecord(array $formElement, $elementHtml);
 
-    /**
-     * Builds a label, typically for an html-'<input>'-element.
-     *
-     * @param string $htmlFormElementName
-     * @param string $label
-     * @return string
-     */
-    public function buildLabel($htmlFormElementName, $label) {
-        $attributes = Support::doAttribute('for', $htmlFormElementName);
-        $attributes .= Support::doAttribute('class', 'control-label');
-
-        $html = Support::wrapTag("<label $attributes>", $label);
-
-        return $html;
-    }
-
     /**
      * Builds HTML 'input' element.
      * Format: <input name="$htmlFormElementName" <type="email|input|password|url" [autocomplete="autocomplete"] [autofocus="autofocus"]
-- 
GitLab