/**
* @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;
}