@EXT\Route(
"/new/form",
name="claro_workspace_creation_form"
)

@EXT\Template()

Renders the workspace creation form.

@return array
434998
public function creationFormAction()
    {
        $this->assertIsGranted('ROLE_WS_CREATOR');
        $user = $this->tokenStorage->getToken()->getUser();
        $form = $this->formFactory->create(FormFactory::TYPE_WORKSPACE, array($user));

        return array('form' => $form->createView());
    }
825383
public function newAction() {

        $entity = new Role();

        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
1348563
public function build()
    {
        $this->buildForm();

        $this->extendForm();

        $this->readForm();

        return [
            'formFields' => $this->fields,
            'formOpen' => $this->open(),
            'formActions' => $this->actions()
        ];
    }
1180255
public function newAction()
    {
        $entity = new ProductOrder();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
1202384
public function form()
    {
        $this->breadcrumb->onForm();
        $all  = $this->prepare();
        $this->roundRobin->build();
        $form = $this->form->of("antares.tester: test", function (FormGrid $form) use ($all) {
            $model = new Fluent([]);
            $form->setup($this, "antares::tools/tester/prepare", $model, ['id' => 'tester-form']);
            $form->name('Module tester');
            foreach ($all as $module => $tests) {
                $form->fieldset($module, function (Fieldset $fieldset) use ($tests) {
                    $fieldset->control('input:text', '', function($control) use($tests) {
                        $control->field = function() use($tests) {
                            return view('antares/tester::admin.partials._module', ['tests' => $tests]);
                        };
                    });
                });
            }
            $form->layout('antares/tester::admin.partials._form');
        });

        $form->grid->submit = trans('Start testing');
        return $form;
    }
558620
public function mailServerFormAction()
    {
        $platformConfig = $this->configHandler->getPlatformConfig();
        $form = $this->formFactory->create(
            new AdminForm\MailServerType(
                $platformConfig->getMailerTransport(),
                $this->configHandler->getLockedParamaters()
            ),
            $platformConfig
        );

        return array('form_mail' => $form->createView());
    }
1095664
public function createAction()
    {
        $this->assertIsGranted('ROLE_WS_CREATOR');
        $user = $this->tokenStorage->getToken()->getUser();
        $form = $this->formFactory->create(FormFactory::TYPE_WORKSPACE, array($user));
        $form->handleRequest($this->request);
        $ds = DIRECTORY_SEPARATOR;
        $modelLog = $this->container->getParameter('kernel.root_dir') . '/logs/models.log';
        $logger = FileLogger::get($modelLog);
        $this->workspaceManager->setLogger($logger);

        if ($form->isValid()) {
            $model = $form->get('model')->getData();

            if (!is_null($model)) {
                $this->createWorkspaceFromModel($model, $form);
            } else {
                $config = Configuration::fromTemplate(
                    $this->templateDir . $ds . 'default.zip'
                );
                $config->setWorkspaceName($form->get('name')->getData());
                $config->setWorkspaceCode($form->get('code')->getData());
                $config->setDisplayable($form->get('displayable')->getData());
                $config->setSelfRegistration($form->get('selfRegistration')->getData());
                $config->setRegistrationValidation($form->get('registrationValidation')->getData());
                $config->setSelfUnregistration($form->get('selfUnregistration')->getData());
                $config->setWorkspaceDescription($form->get('description')->getData());

                $user = $this->tokenStorage->getToken()->getUser();
                $this->workspaceManager->create($config, $user);
            }
            $this->tokenUpdater->update($this->tokenStorage->getToken());
            $route = $this->router->generate('claro_workspace_by_user');

            $msg = $this->get('translator')->trans(
                'successfull_workspace_creation',
                array('%name%' => $form->get('name')->getData()),
                'platform'
            );
            $this->get('request')->getSession()->getFlashBag()->add('success', $msg);

            return new RedirectResponse($route);
        }

        return array('form' => $form->createView());
    }
493625
public function newAction()
    {
        $entity = new MediaType();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1062796
public function multipleTeamsCreateFormAction(Workspace $workspace, User $user)
    {
        $this->checkWorkspaceManager($workspace, $user);
        $params = $this->teamManager->getParametersByWorkspace($workspace);
        $form = $this->formFactory->create(new MultipleTeamsType($params));

        return array(
            'form' => $form->createView(),
            'workspace' => $workspace
        );
    }
523451
protected function buildForm()
    {
        // Create countries and shipping modules list
        $countries = [0 => '   '];

        $list = CountryQuery::create()->find();

        /** @var \Thelia\Model\Country $item */
        foreach ($list as $item) {
            $countries[$item->getId()] = $item->getTitle();
        }

        asort($countries);

        $countries[0] = Translator::getInstance()->trans("All countries");

        $modules = [0 => '   '];

        $list = ModuleQuery::create()->filterByActivate(BaseModule::IS_ACTIVATED)->filterByType(BaseModule::DELIVERY_MODULE_TYPE)->find();

        /** @var Module $item */
        foreach ($list as $item) {
            $modules[$item->getId()] = $item->getTitle();
        }

        asort($modules);

        $modules[0] = Translator::getInstance()->trans("All shipping methods");

        $this->formBuilder
            ->add(
                'code',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkDuplicateCouponCode"],
                                ],
                                "groups" => "creation",
                            ]
                        ),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkCouponCodeChangedAndDoesntExists"],
                                ],
                                "groups" => "update",
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'title',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                    ]
                ]
            )
            ->add(
                'shortDescription',
                'text'
            )
            ->add(
                'description',
                'textarea'
            )
            ->add(
                'type',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new NotEqualTo(
                            [
                                'value' => -1,
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'isEnabled',
                'text',
                []
            )
            ->add(
                'startDate',
                'text',
                [
                    'constraints' => [
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkLocalizedDate"],
                                ],
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'expirationDate',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkLocalizedDate"],
                                    [$this, "checkConsistencyDates"],
                                ],
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'isCumulative',
                'text',
                []
            )
            ->add(
                'isRemovingPostage',
                'text',
                []
            )
            ->add(
                'freeShippingForCountries',
                'choice',
                [
                    'multiple' => true,
                    'choices'  => $countries
                ]
            )
            ->add(
                'freeShippingForModules',
                'choice',
                [
                    'multiple' => true,
                    'choices'  => $modules
                ]
            )
            ->add(
                'isAvailableOnSpecialOffers',
                'text',
                []
            )
            ->add(
                'maxUsage',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new GreaterThanOrEqual(['value' => -1]),
                    ]
                ]
            )
            ->add(
                'perCustomerUsageCount',
                'choice',
                [
                    'multiple' => false,
                    'required' => true,
                    'choices'  => [
                        1 => Translator::getInstance()->trans('Per customer'),
                        0 => Translator::getInstance()->trans('Overall'),
                    ]
                ]
            )
            ->add(
                'locale',
                'hidden',
                [
                    'constraints' => [
                        new NotBlank(),
                    ]
                ]
            )
            ->add(
                'coupon_specific',
                'collection',
                [
                    'allow_add'    => true,
                    'allow_delete' => true,
                ]
            )
        ;
    }
998748
public function newAction()
    {
        $entity = new Family();
        $form   = $this->createForm(new FamilyType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
931797
public function newAction()
    {
        $stockchangelog = new StockChangeLog();
        $form = $this->createForm(new StockChangeLogType(), $stockchangelog);

        return array(
            'stockchangelog' => $stockchangelog,
            'form' => $form->createView(),
        );
    }
1060345
public function menuAction()
    {
        $workspaces = [];
        $personalWs = null;

        $user = null;
        $token = $this->tokenStorage->getToken();
        if ($token) {
            $user = $token->getUser();
        }

        if ($user instanceof User) {
            $personalWs = $user->getPersonalWorkspace();
            $workspaces = $this->workspaceManager->getRecentWorkspaceForUser($user, $this->utils->getRoles($token));
        }

        return new JsonResponse([
            'creatable' => $this->authorization->isGranted('CREATE', new Workspace()),
            'personal' => $personalWs ? $this->serializer->serialize($personalWs, [Options::SERIALIZE_MINIMAL]) : null,
            'history' => array_map(function (Workspace $workspace) {
                return $this->serializer->serialize($workspace, [Options::SERIALIZE_MINIMAL]);
            }, $workspaces),
        ]);
    }
18660
public function showModelModalFormAction(Workspace $workspace)
    {
        $this->checkAccess($workspace);
        $form = $this->formFactory->create(new ModelType(), new WorkspaceModel());
        $action = $this->router->generate('claro_workspace_model_create', array('workspace' => $workspace->getId()));

        return array(
            'form' => $form->createView(),
            'action' => $action,
            'title' => 'create_model'
        );
    }
893322
public function createForm()
    {
        $this->collapse->childNodes->push(new Navbar\Form());

        return $this->form = $this->collapse->childNodes->last();
    }
385235
public function newAction()
    {
        $entity = new Category();
        $form   = $this->createForm(new CategoryType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1053113
public function sessionFormAction()
    {
        $config = $this->configHandler->getPlatformConfig();
        $form = $this->formFactory->create(
            new AdminForm\SessionType(
                $config->getSessionStorageType(),
                $config,
                $this->configHandler->getLockedParamaters()
            )
        );

        return array('form' => $form->createView());
    }