Create a new form group widget.

@param  array|null $data Optional. The form group data to set.
@return FormGroupInterface
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;
    }
939551
public function createLanguage(
        ?LanguageCreateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(LanguageCreateType::class);

        return $this->formFactory->createNamed(
            $name,
            LanguageCreateType::class,
            $data ?? new LanguageCreateData()
        );
    }
180674
public function create(array $data)
    {
        if ($this->configHandler->hasParameter('is_cron_configured') &&
            $this->configHandler->getParameter('is_cron_configured')) {
            return $this->update($data, new ScheduledTask());
        }

        return null;
    }
566606
protected function createPagination(array $data = null)
    {
        $pagination = new DatabasePagination();
        if ($data !== null) {
            $pagination->setData($data);
        }
        return $pagination;
    }
1165327
public static function create($data)
    {
        if (!$data) {
            return new self(self::COLLECTION_NAME);
        }

        $type = null;
        if (isset($data[self::COLLECTION_NAME])) {
            $type = self::COLLECTION_NAME;
        } elseif (isset($data[self::CONDITION_NAME])) {
            $type = self::CONDITION_NAME;
        }
        if (null === $type) {
            throw new ContainerException(
                sprintf('Invalid container type. Use %s', implode(' or ', self::ALLOWED_TYPES))
            );
        }
        if (!is_array($data[$type])) {
            throw new ContainerException(sprintf('Parameter "%s" must be array', $type));
        }
        /** @var Container $mainContainer */
        $mainContainer = new self($type);
        if (isset($data[self::AND_OR_OPERATOR_NAME])) {
            $mainContainer->setAndOr($data[self::AND_OR_OPERATOR_NAME]);
        }
        if (self::COLLECTION_NAME === $type) {
            foreach ($data[$type] as $datum) {
                $mainContainer->addToCollection(self::create($datum));
            }
        } elseif (self::CONDITION_NAME === $type) {
            $mainContainer->getCondition()->setData($data[$type]);
        }

        return $mainContainer;
    }
784238
protected function create($data = null)
    {
        $method = '__'.str_replace(__CLASS__.'::', '', __METHOD__);

        if ($this->hasMethod($method) && is_callable([$this, $method])) {
            $arguments = func_get_args();
            if (empty($arguments)) {
                $result = $this->{$method}();
            } else {
                $result = call_user_func_array([$this, $method], $arguments);
            }

            return $result;
        }
    }
61707
public function createFormBuilder($data = null, array $options = array())
    {
        return $this->getContainer()->get('form.factory')->createBuilder('form', $data, $options);
    }
974918
public function formProperties(array $group = null)
    {
        $obj = $this->obj();
        $props = $obj->metadata()->properties();

        // We need to sort form properties by form group property order if a group exists
        if (!empty($group)) {
            $props = array_merge(array_flip($group), $props);
        }

        foreach ($props as $propertyIdent => $propertyMetadata) {
            if (method_exists($obj, 'filterPropertyMetadata')) {
                $propertyMetadata = $obj->filterPropertyMetadata($propertyMetadata, $propertyIdent);
            }

            if (!is_array($propertyMetadata)) {
                throw new UnexpectedValueException(sprintf(
                    'Invalid property data for "%1$s", received %2$s',
                    $propertyIdent,
                    (is_object($propertyMetadata) ? get_class($propertyMetadata) : gettype($propertyMetadata))
                ));
            }

            $propertyMetadata['display_options'] = $this->displayOptions();

            $formProperty = $this->createFormProperty();
            $formProperty->setViewController($this->viewController());
            $formProperty->setPropertyIdent($propertyIdent);
            $formProperty->setData($propertyMetadata);
            $formProperty->setPropertyVal($obj[$propertyIdent]);

            if ($formProperty->hidden()) {
                $this->hiddenProperties[$propertyIdent] = $formProperty;
            } else {
                yield $propertyIdent => $formProperty;
            }
        }
    }
899015
public function create($data)
    {
        $methodDescriptor = new MethodDescriptor();
        $methodDescriptor->setNamespace(
            substr(
                (string) $data->getFqsen(),
                0,
                -strlen($data->getName()) - 4
            )
        );
        $this->mapReflectorToDescriptor($data, $methodDescriptor);

        $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor);
        $this->addArguments($data, $methodDescriptor);
        $this->addVariadicArgument($data, $methodDescriptor);

        return $methodDescriptor;
    }
490100
public function setResponse(array $data = null)
    {
        $this->DataArray    = $data;
        $this->ResponseData = json_encode($data);
        return $this;
    }
555268
public function setData(array $data)
    {
        if (isset($data['attachables'])) {
            $this->setAttachables($data['attachables']);
        }

        if (isset($data['groups'])) {
            $this->setGroups($data['groups']);
        }

        if (isset($data['widgets'])) {
            $this->setWidgets($data['widgets']);
        }

        unset($data['attachables'], $data['groups'], $data['widgets']);

        return parent::setData($data);
    }
783856
public function data(array $data = null)
    {
        if (is_null($data)) {
            return $this->data;
        }

        $this->data = $data;

        return $this;
    }
532788
protected function getFilterFromData($data): FilterInterface
    {
        if (($groupAndData = $this->getArrayValue($data, 'and')) !== null) {
            $group = new GroupAndFilter();
            foreach ($groupAndData as $filter) {
                $group->push($this->getFilterFromData($filter));
            }

            return $group;
        }
        if (($groupOrData = $this->getArrayValue($data, 'or')) !== null) {
            $group = new GroupOrFilter();
            foreach ($groupOrData as $filter) {
                $group->push($this->getFilterFromData($filter));
            }

            return $group;
        }

        // No group filter; must be a regular Filter
        $field = $this->getArrayValue($data, 'f');
        return new Filter($field, $this->getArrayValue($data, 'o'), $this->getArrayValue($data, 'd'));
    }
1220690
public function createNew($data)
    {
        if ($data instanceof File) {
            /** @var $data File */
            $media = new Media();
            if (method_exists($data, 'getClientOriginalName')) {
                $media->setOriginalFilename($data->getClientOriginalName());
            } else {
                $media->setOriginalFilename($data->getFilename());
            }
            $media->setContent($data);

            $contentType = $this->mimeTypeGuesser->guess($media->getContent()->getPathname());
            $media->setContentType($contentType);

            return $media;
        }

        return null;
    }
42722
protected function createPagination(array $data = null)
    {
        $pagination = new Pagination();
        if ($data !== null) {
            $pagination->setData($data);
        }
        return $pagination;
    }
1358282
public function deleteContentTypeGroup(
        ContentTypeGroupDeleteData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('delete-content-type-group-%d', $data->getContentTypeGroup()->id);

        return $this->formFactory->createNamed($name, ContentTypeGroupDeleteType::class, $data);
    }
185384
public function updateObjectStateGroup(
        ObjectStateGroupUpdateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('update-object-state-group-%d', $data->getObjectStateGroup()->id);

        return $this->formFactory->createNamed($name, ObjectStateGroupUpdateType::class, $data);
    }