Creates and returns a Form instance from the type of the form.

@param  mixed $data     The initial data for the form
@param  array $options  Options for the form

@return \Symfony\Component\Form\Form
772173
public function createForm($data = null, array $options = [])
    {
        return $this->formFactory->create(NodeFormType::class, $data, $options);
    }
482339
protected function createFromArrayWithContext($data, $options)
    {
        $_documentClass = $this->_documentClass;

        return $_documentClass::createFromArray($data, $options);
    }
1295610
public function createDefinitionForm($data): ?FormBuilderInterface
    {
        if (!$this->context->getDefinition()->hasMeta('form')) {
            return null;
        }

        $formConfig = $this->context->getDefinition()->getMeta('form') ?? [];
        $formType = $formConfig['type'] ?? null;
        if (!$formConfig || !$formType) {
            throw new \RuntimeException(sprintf('Can`t find a valid form for %s', $this->context->getDefinition()->getName()));
        }

        $options = [
            'allow_extra_fields' => true,
            'endpoint' => $this->context->getEndpoint()->getName(),
        ];

        if ($this->container->hasParameter('form.type_extension.csrf.enabled')
            && $this->container->getParameter('form.type_extension.csrf.enabled')) {
            $options['csrf_protection'] = false;
        }

        $options = array_merge($options, $formConfig['options'] ?? []);

        return $this->createFormBuilder($formType, $data, $options);
    }
479694
public function make(array $data = null, array $options = null)
    {
        $data = $data ? $data : $this->getData();
        $this->setData($data);

        $options = $options ? $options : $this->getOptions();
        $options = array_replace_recursive($this->getDefaults(), $options);
        $this->setOptions($options);




        if ($this->isShowRowCheckbox()) {
            $this->addRowCheckbox();
        }

        if ($this->isShowRowIndex()) {
            $this->addRowIndex();
        }

        if ($this->isShowColSearch()) {
            $this->addColSearch();
        }

        $options = $this->getOptions();
        $data = $this->getData();

        $attributes = [];

        // Attributes for wrappers
        $attributes['table'] = $this->getAttributes('table', $options);
        $attributes['caption'] = $this->getAttributes('caption', $options);
        $attributes['colgroup'] = $this->getAttributes('colgroup', $options);
        $attributes['thead'] = $this->getAttributes('thead', $options);
        $attributes['tbody'] = $this->getAttributes('tbody', $options);
        $attributes['tfoot'] = $this->getAttributes('tfoot', $options);

        // caption
        $caption = isset($options['caption']['value']) ?
            $options['caption']['value'] : '';

        // colgroup data
        $cols = '';
            if (is_array($options['colgroup']) && $this->isShowColgroup()) {
            $colsData = isset($options['colgroup']['value']) ?
                $options['colgroup']['value'] : array_slice($data, 0, 1);
            $cols = $this->getColgroup($colsData, $options);
        }

        // thead data
        $thead_rows = '';
        if (is_array($options['thead']) && $this->isShowThead()) {
            $theadData = isset($options['thead']['value']) ?
                $options['thead']['value'] : array_slice($data, 0, 1);
            $theadData = is_callable($theadData) ? $theadData($data) : $theadData;
            $thead_rows = $this->getGrid($theadData, 'thead_tr', 'th',
                $options);
        }

        // tfoot data
        $tfoot_rows = '';
        if (is_array($options['tfoot']) && $this->isShowTfoot()) {
            $tfootData = isset($options['tfoot']['value']) ?
                $options['tfoot']['value'] : null;
            $tfootData = is_callable($tfootData) ? $tfootData($data) : $tfootData;
            $tfoot_rows = $this->getGrid($tfootData, 'tfoot_tr', 'tfoot_td',
                $options);
        }

        // tbody data
        $tbody_rows = $this->getGrid($data, 'tr', 'td', $options);

        // Render wrappers
        $caption = empty($caption) ?
            '' : sprintf($options['caption']['tag'], $attributes['caption'],
                $caption);

        $colgroup = empty($cols) ?
            '' : sprintf($options['colgroup']['tag'], $attributes['colgroup'],
                $cols);

        $thead = empty($thead_rows) ?
            '' : sprintf($options['thead']['tag'], $attributes['thead'],
                $thead_rows);

        $tbody = sprintf($options['tbody']['tag'], $attributes['tbody'],
            $tbody_rows);

        $tfoot = empty($tfoot_rows) ?
            '' : sprintf($options['tfoot']['tag'], $attributes['tfoot'],
                $tfoot_rows);

        $table = $caption .$colgroup . $thead . $tbody . $tfoot;

        return sprintf($options['table']['tag'], $attributes['table'], $table);
    }
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();
    }
1347936
protected function createNodeInstance(array $data, array $options = []): NodeInterface
    {
        $factory = $this->getNodeFactory();

        $node = $factory($data, $options);

        if (!is_object($node) || !($node instanceof NodeInterface)) {
            throw ValidationException::create(
                'Node Factory must return an instance of NodeInterface.'
            );
        }

        $this->_nodeRegistry[$node->getId()] = $node;

        return $node;
    }
1365898
protected function createCommandFromData(FormInterface $form, Options $options)
    {
        $reflection = new ReflectionClass($this->getCommandClass());
        $data = [];
        /** @var FormInterface $field */
        foreach ($form as $field) {
            $data[$field->getName()] = $field->getData();
        }

        return $reflection->newInstanceArgs($data);
    }
608891
protected function renderTemplate($data, array $options)
    {
        return $this->twig->render(
            $options['template'],
            array_merge($options['context'], ['column' => $options['column'], 'data' => $data])
        );
    }
178841
public function make($dataClass = null, $options = [], $builder = FormBuilder::class): FormBuilderInterface
    {
        $dataMapperManager = new DataMapperManager(PropertyAccess::createPropertyAccessor());

        $form = new Form(
            $dataClass,
            new FieldsRepository(),
            $this->validation,
            $this->viewer,
            $dataMapperManager
        );
        $form->setManager($this->manager);
        $form->setResourceTransformerFactory($this->factory);
        $form->setAttributes($this->attributes);
        $form->setOptions($options);

        $this->builder = new $builder($form, $dataMapperManager, $dataClass);

        return $this->builder;
    }
1002524
protected function crudForm(FormTypeInterface $type, $data = null, array $options = array())
    {
        return $this->crudFormFactory()->create($type, $data, $options);
    }
177641
public function provide($data = null, array $options = [])
    {
        $result = parent::provide($data, $options);

        if (empty($result)) {
            return $result;
        }

        // Auto-paragraph
        $view = $this->config->getView();
        $result = $view->Text->autoParagraph($result);

        return $result;
    }
667330
public function createDocument($collection, array $data, array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->create($data);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
906588
public function attachData($data, $options=[]) {
		$attachment = \Swift_Attachment::newInstance($data);
		if(isset($options['filename']))
			$attachment->setFilename($options['filename']);
		if(isset($options['mime']))
			$attachment->setContentType($options['mime']);
		return $this->attach($attachment);
	}
550645
protected function createFormGroup(array $data = null)
    {
        if (isset($data['type'])) {
            $type = $data['type'];
        } else {
            $type = $this->defaultGroupType();
        }

        $group = $this->formGroupFactory()->create($type);
        $group->setForm($this->formWidget());

        if ($data !== null) {
            $group->setData($data);
        }

        return $group;
    }
46436
public function createUrlEditForm(
        URLUpdateData $data = null,
        ?string $name = null,
        array $options = []
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(SearchData::class);

        return $this->formFactory->createNamed($name, URLEditType::class, $data, $options);
    }
1260895
public function stringToObject($data, array $options = array())
	{
		$obj = new stdClass;

		// Parse the XML string.
		$xml = simplexml_load_string($data);

		foreach ($xml->children() as $node)
		{
			$obj->$node['name'] = $this->getValueFromNode($node);
		}

		return $obj;
	}
959755
public function getForm(
        Action $action,
        Request $request,
        DataInterface $data,
        array $options = []
    ): FormInterface {
        $defaultOptions = $this->getDefaultFormOptions($action, $request, $data);

        return $this->getFormBuilder($action, $data, array_merge($defaultOptions, $options))->getForm();
    }