Matthias\SymfonyConsoleForm\Form\FormUtil::label PHP Метод

label() публичный статический Метод

public static label ( Symfony\Component\Form\FormInterface $form ) : string
$form Symfony\Component\Form\FormInterface
Результат string
    public static function label(FormInterface $form)
    {
        $label = $form->getConfig()->getOption('label');
        if (!$label) {
            $label = self::humanize($form->getName());
        }
        return $label;
    }

Usage Example

 /**
  * @param string|\Symfony\Component\Form\FormTypeInterface $formType
  * @param array                                            &$resources
  *
  * @return InputDefinition
  */
 public function createForFormType($formType, array &$resources = [])
 {
     $resources[] = new FileResource(__FILE__);
     $form = $this->formFactory->create($formType);
     $actualFormType = $form->getConfig()->getType()->getInnerType();
     $reflection = new \ReflectionObject($actualFormType);
     $resources[] = new FileResource($reflection->getFileName());
     $inputDefinition = new InputDefinition();
     foreach ($form->all() as $name => $field) {
         if (!$this->isFormFieldSupported($field)) {
             continue;
         }
         $type = InputOption::VALUE_REQUIRED;
         $default = $field->getConfig()->getOption('data', null);
         $description = FormUtil::label($field);
         $inputDefinition->addOption(new InputOption($name, null, $type, $description, $default));
     }
     return $inputDefinition;
 }
All Usage Examples Of Matthias\SymfonyConsoleForm\Form\FormUtil::label