@param TrashEmptyData|null $data
@param null|string $name

@return FormInterface
540312
public function emptyTrash(
        TrashEmptyData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(TrashEmptyType::class);

        return $this->formFactory->createNamed($name, TrashEmptyType::class, $data);
    }
1020398
public function editUser(
        UserEditData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(UserEditType::class);
        $data = $data ?? new UserEditData();
        $options = null !== $data->getVersionInfo()
            ? ['language_codes' => $data->getVersionInfo()->languageCodes]
            : [];

        return $this->formFactory->createNamed($name, UserEditType::class, $data, $options);
    }
916994
public function updateLanguage(
        LanguageUpdateData $data,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('update-language-%d', $data->getLanguage()->id);

        return $this->formFactory->createNamed($name, LanguageUpdateType::class, $data);
    }
896899
public function data($name = null)
    {
        if ($this->_Controller->request->is('get')) {
            if (empty($name)) {
                return $this->_Controller->request->query;
            } else {
                return $this->_Controller->request->query($name);
            }
        } elseif ($this->_Controller->request->is(['post', 'put'])) {
            if (empty($name)) {
                return $this->_Controller->request->data[$this->formName];
            } else {
                return $this->_Controller->request->data($this->fieldName($name));
            }
        }

        return null;
    }
185654
public function createPolicy(
        ?PolicyCreateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(PolicyCreateType::class);

        return $this->formFactory->createNamed($name, PolicyCreateType::class, $data);
    }
256168
public function show($name = null, $data = []) {
        Factory::timer()->record('view render');
        return $this->showContent($this->renderHtml($name, $data));
    }
522213
public function getEmptyForm(
        Action $action,
        Request $request,
        $data
    ): FormInterface {
        $dataId = $data && method_exists($data, 'getId') ? $data->getId() : null;
        $formOptions = $this->getDefaultFormOptions($action, $request, $dataId);

        return $this->formFactory->createNamedBuilder(
            "form_{$action->getAdmin()->getCode()}_{$action->getCode()}",
            FormType::class,
            null,
            $formOptions
        )->getForm();
    }
326436
public function deleteContentTypes(
        ContentTypesDeleteData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(ContentTypesDeleteType::class);

        return $this->formFactory->createNamed($name, ContentTypesDeleteType::class, $data);
    }
115759
public function createRoleAssignment(
        ?RoleAssignmentCreateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(RoleAssignmentCreateType::class);

        return $this->formFactory->createNamed(
            $name,
            RoleAssignmentCreateType::class,
            $data ?? new RoleAssignmentCreateData()
        );
    }
187253
public function copyLocationSubtree(
        LocationCopySubtreeData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(LocationCopySubtreeType::class);

        return $this->formFactory->createNamed($name, LocationCopySubtreeType::class, $data);
    }
309014
public function updateLocation(
        LocationUpdateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(LocationUpdateType::class);

        return $this->formFactory->createNamed($name, LocationUpdateType::class, $data);
    }
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);
    }
979982
public function forgotUserPasswordWithLogin(
        UserPasswordForgotWithLoginData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(UserPasswordForgotWithLoginType::class);

        return $this->formFactory->createNamed($name, UserPasswordForgotWithLoginType::class, $data);
    }
413043
public static function getHelper($name, HandlebarsData $data = null)
    {
        if (isset(self::$helpers[$name])) {
            if (!is_null($data) && self::$helpers[$name] instanceof Closure) {
                return self::$helpers[$name]->bindTo($data, get_class($data));
            }
            
            return self::$helpers[$name];
        }
        
        return null;
    }
1340205
public function getEmptyForm(
        Action $action,
        Request $request,
        DataInterface $data
    ): FormInterface {
        $formOptions = $this->getDefaultFormOptions($action, $request, $data);
        unset($formOptions['family'], $formOptions['fieldset_options']);

        return $this->formFactory->createNamedBuilder(
            "form_{$action->getAdmin()->getCode()}_{$action->getCode()}",
            FormType::class,
            null,
            $formOptions
        )->getForm();
    }
1028009
public function getDataMapper($name = null)
    {
        $mapperName = $name ?: $this->dataMapper;

        if ($mapperName === false) {
            return new NullDataMapper();
        }

        $mapperName = $mapperName ?: $this->getName();

        // (1) If name is class, just new it.
        if (class_exists($mapperName)) {
            return new $mapperName($this->table, $this->keys, $this->db);
        }

        // (2): Find object from registered namespaces
        if ($mapper = DataMapperResolver::create($mapperName, $this->table, $this->keys, $this->db)) {
            return $mapper;
        }

        $errors[] = sprintf(
            'DataMapper: "%s" not found from namespaces: (%s)',
            $mapperName,
            implode(" |\n ", DataMapperResolver::dumpNamespaces())
        );

        // (3): Find from package directory.
        $class = sprintf(
            '%s\DataMapper\%sMapper',
            MvcHelper::getPackageNamespace(get_called_class(), 2),
            ucfirst($mapperName)
        );

        if (class_exists($class)) {
            return new $class($this->table, $this->keys, $this->db);
        }

        $errors[] = sprintf('Class: %s not exists.', $class);

        // If name is NULL and this model prepared a default mapper name.
        // We must throw exception to tell developers mapper not found.
        if (!$name && $this->dataMapper) {
            throw new \LogicException(implode("\n- ", $errors));
        }

        // If name not NULL, set it as table name, otherwise use pre-set table property.
        $table = $name ?: $this->table;

        if (!$table) {
            throw new \LogicException(sprintf(
                "Please add table property to %s to support DataMapper object. \n%s",
                static::class,
                implode("\n- ", $errors)
            ));
        }

        // (4): If name is null, we get default object with table name provided.
        return new DataMapper($table, $this->keys, $this->db);
    }
26514
public function updatePolicy(
        PolicyUpdateData $data,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: sprintf('update-policy-%s', md5(implode('/', $data->getPolicy())));

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