Explorar o código

Merge pull request #652 from pulzarraider/help_message_alternative_syntax

Help message alternative syntax
Thomas %!s(int64=13) %!d(string=hai) anos
pai
achega
613086a1f0
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      Form/FormMapper.php

+ 10 - 0
Form/FormMapper.php

@@ -124,7 +124,17 @@ class FormMapper
                 $options['label'] = $this->admin->getLabelTranslatorStrategy()->getLabel($fieldDescription->getName(), 'form', 'label');
             }
 
+            $help = null;
+            if (isset($options['help'])) {
+                $help = $options['help'];
+                unset($options['help']);
+            }
+
             $this->formBuilder->add($name, $type, $options);
+
+            if (null !== $help) {
+                $this->admin->getFormFieldDescription($name)->setHelp($help);
+            }
         }
 
         return $this;