@param FormInterface $field

@return bool
482686
private function isFormFieldSupported(FormInterface $field)
    {
        if ($field->getConfig()->getCompound()) {
            if ($field->getConfig()->getType()->getInnerType() instanceof RepeatedType) {
                return true;
            }

            return false;
        }

        return true;
    }
993691
protected function cropAlternative(FormInterface $form)
    {
        $needFlush = false;
        foreach ($this->thumbnailConfig as $format => $parameters) {
            $x = $form->get('coordinates')->get($format)->get('x')->getData();
            $y = $form->get('coordinates')->get($format)->get('y')->getData();
            $h = $form->get('coordinates')->get($format)->get('h')->getData();
            $w = $form->get('coordinates')->get($format)->get('w')->getData();
            if (null !== $x && null !== $y && null !== $h && null !== $w) {
                $media = $form->getData();
                $this->imageAlternativeStrategy->cropAlternative($media, $x, $y, $h, $w, $format);
                $this->objectManager->persist($media);
                $needFlush = true;
            }
        }
        if ($needFlush) {
            $this->objectManager->flush();
        }
    }
433175
protected function getErrorsFromForm(FormInterface $form)
    {
        $errors = [];
        /** @var FormError $error */

        if($form->getErrors()->count() === 0 && $form->isRoot() && !$form->isValid()){
            $errors["_self"] = "Empty post data";
        }

        foreach ($form->getErrors() as $error) {
            $key = $error->getOrigin()->getName();
            $errors[($form->isRoot()) ? "_self" : $key] = $error->getMessage();
        }

        foreach ($form->all() as $childForm) {
            if ($childForm instanceof FormInterface) {
                if ($childErrors = $this->getErrorsFromForm($childForm)) {
                    unset($errors["_self"]);
                    $errors = array_merge_recursive($errors, $childErrors);
                }
            }
        }

        return $errors;
    }
376216
protected function crudCreateIsSubmitted(FormInterface $form)
    {
        $buttonName = $this->crudCreateButtonName();
        if (null !== $buttonName && !$form->get($buttonName)->isClicked()) {
            return false;
        }

        return true;
    }
881356
private static function password(FormInterface $form)
    {
        if ($form->has('credentials_group')) {
            $credentialsGroup = $form->get('credentials_group');

            if ($credentialsGroup->has('plainPassword')) {
                $plainPasswordElement = $credentialsGroup->get('plainPassword');

                if (!empty($plainPasswordElement->getData())) {
                    return 'CsrPassword';
                }
            }
        }
    }
869175
private function buildId(FormInterface $form)
    {
        $id = $form->getName();

        if (null !== $form->getParent()) {
            $id = $this->buildId($form->getParent()).'_'.$id;
        }

        return $id;
    }
257723
public function buildContentFieldValue(FormBuilderInterface $builder, FieldInterface $field)
    {
        $builder->add('value', $this->getFormFieldType(), array_merge(
            $this->getDefaultFormFieldValueOptions($field),
            $this->getFormFieldValueOptions($field)
        ));

        $modelTransformer = $this->getValueModelTransformer($field);
        if ($modelTransformer !== null) {
            $builder->get('value')
                ->addModelTransformer($modelTransformer);
        }
    }
1210532
public function createFormView(FormInterface $form)
    {
        $post = $this->eavManager->initializeEntity($form->getSchema());

        $form = $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]);

        return $form->createView();
    }
875191
private function publicPropertyPath(FormInterface $form, $path)
    {
        $pathArray = [$path];

        if (strpos($path, '.') !== false) { // object.child.property
            $pathArray = explode('.', $path);
        }

        if (strpos($path, '[') !== false) { //[array][child][property]
            $path = str_replace(']', null, $path);
            $pathArray = explode('[', $path);
        }

        if (in_array($pathArray[0], ['data', 'children'])) {
            array_shift($pathArray);
        }

        $contextForm = $form;
        foreach ($pathArray as &$propName) {
            //for some reason some inputs are resolved as "inputName.data" or "inputName.children"
            //because the original form property is children[inputName].data
            //this is the case of DEMO AddUserInput form the login field is validated as path children[login].data
            //the following statements remove the trailing ".data"
            if (preg_match('/\.(data|children)$/', $propName)) {
                $propName = preg_replace('/\.(data|children)/', null, $propName);
            }

            $index = null;
            if (preg_match('/(\w+)(\[\d+\])$/', $propName, $matches)) {
                list(, $propName, $index) = $matches;
            }
            if (!$contextForm->has($propName)) {
                foreach ($contextForm->all() as $child) {
                    if ($child->getConfig()->getOption('property_path') === $propName) {
                        $propName = $child->getName();
                    }
                }
            }
            if ($index) {
                $propName = sprintf('%s%s', $propName, $index);
            }
        }
        unset($propName);

        return implode('.', $pathArray);
    }
472129
protected function allowedToUseFormFieldData(ModelFormFieldDataInterface $field)
    {
        if ( ! $field->adminOnly() && ! count($field->permissions())) {
            return true;
        }

        $user = $this->getCore()->auth()->user();

        if ( ! $user || $field->adminOnly() && ! $user->isAdmin()) {
            return false;
        }

        if ($user->isAdmin() || ! count($field->permissions())) {
            return true;
        }

        return $user->can($field->permissions());
    }
633057
public function validate(EventInterface $event)/*# : bool */
    {
        /* @var ResultInterface $result */
        $result = $event->getParam('result');
        $params = $result->getParameters();

        if ($params['id'] < 2000) {
            $result->setStatus(Status::PRECONDITION_FAILED);
            return false;
        }
        return true;
    }
501054
public function containsField($field)
    {
        $identifier = $field instanceof FieldInterface ? $field->getFieldElementName() : $field;
        foreach ($this->getList() as $error) {
            $field = $error->getField();
            if (is_object($field) && $field->getFieldElementName() == $identifier) {
                return true;
            }
        }

        return false;
    }
390336
public function normalize(FormInterface $form)
    {
        $allFields = $form->all();
        if (!empty($allFields)) {
            $result = array();
            $result[$form->getName()] = array();
            foreach ($allFields as $name => $child) {
                $result[$form->getName()][$name] = $this->normalize($child);
            }

            $view = $form->createView();
            if (isset($view['_token'])) {
                $result[$form->getName()]['_token'] = array(
                    'name' => sprintf('%s[%s]', $form->getName(), '_token'),
                    'type' => 'hidden',
                    'required' => true,
                    'data' => $view['_token']->vars['value'],
                );
            }

            return $result;
        }

        $view = $form->createView();
        $flatten = array(
            'name' => $view->vars['full_name'],
            'type' => $view->vars['block_prefixes'][1],
            'required' => array_key_exists('required', $view->vars) ? $view->vars['required'] : false,
            'data' => $form->getData(),
        );

        if (array_key_exists('storage', $view->vars['attr']) && array_key_exists('route', $view->vars['attr']['storage'])) {
            if (array_key_exists('parameters', $view->vars['attr']['storage'])) {
                $flatten['storage'] = $this->router->generate($view->vars['attr']['storage']['route'], $view->vars['attr']['storage']['parameters']);
            } else {
                $flatten['storage'] = $this->router->generate($view->vars['attr']['storage']['route']);
            }
        }

        return $flatten;
    }
676519
public static function typeAncestry(FormInterface $form)
    {
        $types = [];
        self::typeAncestryForType($form->getConfig()->getType(), $types);

        return $types;
    }
939307
protected function sanitize(FieldTypeInterface $field)
    {
        return function ($value, $key, $type) use ($field) {
            $validator = $this->validator->make(
                [$key => $value],
                $this->getTermRules(),
                $this->getTermMessages(),
                $this->getTermPlaceholders()
            );

            $validation = $validator->valid();

            return $validation[$key] ?? null;
        };
    }
602629
public function getSubmittedName(FormInterface $form)
    {
        foreach ($form as $field) {
            if ($field instanceof ClickableInterface && $field->isClicked()) {
                return $field->getName();
            }
        }

        return null;
    }
1090110
protected function translationDomainFrom(FormInterface $form)
    {
        while ((null === $domain = $form->getConfig()->getOption('translation_domain')) && $form->getParent()) {
            $form = $form->getParent();
        }

        return $domain;
    }