@param $name
@param $type
@param array $data
@param array $options
@return BaseForm

This method builds a thelia form with its name
191657
public function createForm($name, $type = "form", array $data = array(), array $options = array())
    {
        if (empty($name)) {
            $name = static::EMPTY_FORM_NAME;
        }

        return $this->getTheliaFormFactory()->createForm($name, $type, $data, $options);
    }
787442
public function attachData($data, $name, array $options = [])
    {
        return $this->laravelMessage->attachData($data, $name, $options);
    }
723539
public function exchange($name, $type = ExchangeType::DIRECT, array $options = [])
    {
        return $this->exchanges[$name] = (new ExchangeBuilder($this, $name, $type))->options($options);
    }
1304806
protected function buildFormOptions($name, array $field, $data = null)
    {
        // Allow sub options structure (collection case)
        if (isset($field['options']['constraints'])) {
            $field['options']['options'] = $this->buildFormOptions('', $field['options']);
        }

        $constraints = array();
        foreach ($field['constraints'] as $constraint) {
            $constraints[] = $this->buildConstraint($constraint);
        }

        $field['options']['constraints'] = $constraints;

        if (null !== $data && isset($data[$name])) {
            $field['options']['data'] = $data[$name];
        }

        return $field['options'];
    }
624432
protected function createTableBuilder(array $options = array(), $type = DataTableType::class)
    {
        return $this->get(DataTableFactory::class)->createBuilder($type, $options);
    }
647447
public static function createFromArray($name, array $data = [])
    {
        $proxy = new static($name);
        $proxy->setDefinition($data);
        if (!isset($data['type'])) {
            throw new \InvalidArgumentException('Missing "type" key in $data param to determine datatype!');
        }
        if (isset($data['properties'])) {
            $proxy->properties = $data['properties'];
        }

        $proxy->setType($data['type']);
        if ($name !== $data['type']) {
            $proxy->setParent($data['type']);
        }

        return $proxy;
    }
1087218
protected function getForm(Request $request, $data, array $options = []): FormInterface
    {
        $action = $this->admin->getCurrentAction();
        $dataId = $data && method_exists($data, 'getId') ? $data->getId() : null;
        $defaultOptions = $this->getDefaultFormOptions($request, $dataId, $action);

        return $this->getFormBuilder($action, $data, array_merge($defaultOptions, $options))->getForm();
    }
162674
public function create($type, SourceDataFactoryInterface $dataFactory, $name)
    {
        if (is_string($type)) {
            $type = $this->typeRegistry->getType($type);
        }

        return new Source($type, $dataFactory, $name);
    }
719965
public function add($name, $type = null, array $options = [], array $fieldDescriptionOptions = [])
    {
        if (null !== $this->apply && !$this->apply) {
            return $this;
        }

        if ($name instanceof FormBuilderInterface) {
            $fieldName = $name->getName();
        } else {
            $fieldName = $name;
        }

        // "Dot" notation is not allowed as form name, but can be used as property path to access nested data.
        if (!$name instanceof FormBuilderInterface && !isset($options['property_path'])) {
            $options['property_path'] = $fieldName;

            // fix the form name
            $fieldName = $this->sanitizeFieldName($fieldName);
        }

        // change `collection` to `sonata_type_native_collection` form type to
        // avoid BC break problems
        if ('collection' === $type || SymfonyCollectionType::class === $type) {
            $type = CollectionType::class;
        }

        $label = $fieldName;

        $group = $this->addFieldToCurrentGroup($label);

        // Try to autodetect type
        if ($name instanceof FormBuilderInterface && null === $type) {
            $fieldDescriptionOptions['type'] = \get_class($name->getType()->getInnerType());
        }

        if (!isset($fieldDescriptionOptions['type']) && \is_string($type)) {
            $fieldDescriptionOptions['type'] = $type;
        }

        if ($group['translation_domain'] && !isset($fieldDescriptionOptions['translation_domain'])) {
            $fieldDescriptionOptions['translation_domain'] = $group['translation_domain'];
        }

        $fieldDescription = $this->admin->getModelManager()->getNewFieldDescriptionInstance(
            $this->admin->getClass(),
            $name instanceof FormBuilderInterface ? $name->getName() : $name,
            $fieldDescriptionOptions
        );

        // Note that the builder var is actually the formContractor:
        $this->builder->fixFieldDescription($this->admin, $fieldDescription, $fieldDescriptionOptions);

        if ($fieldName !== $name) {
            $fieldDescription->setName($fieldName);
        }

        $this->admin->addFormFieldDescription($fieldName, $fieldDescription);

        if ($name instanceof FormBuilderInterface) {
            $this->formBuilder->add($name);
        } else {
            // Note that the builder var is actually the formContractor:
            $options = array_replace_recursive($this->builder->getDefaultOptions($type, $fieldDescription), $options);

            // be compatible with mopa if not installed, avoid generating an exception for invalid option
            // force the default to false ...
            if (!isset($options['label_render'])) {
                $options['label_render'] = false;
            }

            if (!isset($options['label'])) {
                $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($fieldDescription->getName(), $type, $options);

            if (null !== $help) {
                $this->admin->getFormFieldDescription($fieldDescription->getName())->setHelp($help);
            }
        }

        return $this;
    }
1106157
private function createOption($name, $type)
    {
        if (isset($this->mapping[$type][$name])) {
            $class = $this->mapping[$type][$name];
            $option = new $class();
        } elseif (class_exists($name)) {
            $option = new $name();
        } else {
            throw new OptionNotFoundException($name, $type);
        }

        if ($option instanceof OptionRegistryAwareInterface) {
            $option->setOptionRegistry($this);
        }

        return $option;
    }
417372
public function createTable($name, array $options = [])
    {
        $schema = isset($options['schema']) ? new Schema($options['schema']) : null;

        $table = new TableApi($name, $schema, $this->manipulation, $this->actions);

        $primaryKey = isset($options['primary_key'])
            ? new PrimaryKey($options['primary_key'], $table)
            : new PrimaryKey(array(), $table);
        if (isset($options['primary_key_auto_increment']) && false === $options['primary_key_auto_increment']) {
            $primaryKey->disableAutoIncrement();
        }
        $table->addConstraint($primaryKey);

        if (isset($options['comment'])) {
            $table->setDescription($options['comment']);
        }
        $this->actions[] =  function () use ($table) {
             return $this->manipulation->create($table);
        };

        return $table;
    }
873208
public function attachData($data, $name, array $options = array())
    {
        $attachment = $this->createAttachmentFromData($data, $name);

        return $this->prepAttachment($attachment, $options);
    }
780533
public function plain(array $options = [], array $data = [])
    {
        $form = $this->setDependenciesAndOptions(
            $this->container->make($this->plainFormClass),
            $options,
            $data
        );

        $this->eventDispatcher->dispatch(new AfterFormCreation($form));

        $form->filterFields();

        return $form;
    }
30007
public function create($name, $type = null, array $options = [])
    {
        return $this->formBuilder->create($name, $type, $options);
    }
301156
public function createBuilder($type, array $options = [])
    {
        $metaType = $this->createType($type);
        $options = $this->getOptions($metaType, $options);

        $dataClass = isset($options['data_class']) ? $options['data_class'] : Meta::class;
        $builder = new MetaBuilder($this, $dataClass);
        $this->buildMeta($builder, $metaType, $options);

        return $builder;
    }
1073604
public function widget($name, array $data = [], array $options = [])
    {
        $parts = explode('::', $name);
        $name = $parts[0] . 'Widgets';
        $name = empty($parts[1]) ? $name : sprintf('%s::%s', $name, $parts[1]);

        return $this->getView()->cell($name, $data, $options);
    }
4023
public function createForm($type, $data = null, array $options = [])
    {
        return $this->application['form.factory']->create($type, $data, $options);
    }