Explorar el Código

Ticket #4558 - Build-in API support: Age in forms.

AntonLV hace 2 años
padre
commit
38cf00d2be
Se han modificado 1 ficheros con 12 adiciones y 2 borrados
  1. 12 2
      template/scripts/BxBaseFormView.php

+ 12 - 2
template/scripts/BxBaseFormView.php

@@ -913,8 +913,18 @@ BLAH;
         if(!$this->_bViewMode)
             return $this->genRowStandard($aInput);
 
-        $aInput['caption_src'] = '_sys_form_input_age';
-        $aInput['caption'] = _t($aInput['caption_src']);
+        $sTxtAge = '_sys_form_input_age';
+        $aInput = array_merge($aInput, [
+            'caption_src' => $sTxtAge,
+            'caption' => _t($sTxtAge),
+        ]);
+
+        if(bx_is_api())
+            $aInput = array_merge($aInput, [
+                'type' => 'text',
+                'value' => bx_birthday2age($aInput['value'])
+            ]);
+
         return $this->genViewRowWrapped($aInput);
     }