Register action
@param type $data
@param type $form
@return \SS_HTTPResponse
174900
public function doRegister($data, $form)
    {
        $r = new EventRegistration();
        $form->saveInto($r);
        $r->write();

        return "Thanks. We've received your registration.";
    }
1260523
public function registerAction(Request $request)
    {
        $user = new User();
        $form = $this->createRegisterForm($user);

        return array(
            'form' => $form->createView(),
        );
    }
887083
public function doSaveLink($data, Form $form)
    {
        $link = $this->getLinkObject() ? $this->getLinkObject() : Link::create();
        $form->saveInto($link);

        try {
            $link->write();
        } catch (ValidationException $e) {
            $form->sessionMessage($e->getMessage(), 'bad');

            return $form->forTemplate();
        }

        $this->setValue($link->ID);
        $this->setForm($form);

        return $this->FieldHolder();
    }
1221180
public function setActionUrl(Form $form)
    {

        $current = explode('/', rtrim($this->urlProvider->currentUrl(), '/'));

        $lastSegment = array_pop($current);

        if (in_array($lastSegment, ['create','edit'])) {

            $parentUrl = implode('/', $current);

            $form->setAction($parentUrl);

        } else {
            $form->setAction($this->urlProvider->currentUrl());
        }

        if ($lastSegment == 'create') {
            $form->setVerb('post');
            return;
        }

        if($lastSegment == 'edit') {
            $form->setVerb('put');
            return;
        }

    }
1123819
public function submitted(Form $form)
	{
		if (!isset($form['group_action']['submit']) || !$form['group_action']['submit']->isSubmittedBy()) {
			return;
		}

		$values = $form->getValues();
		$values = $values['group_action'];

		if ($values->group_action === 0 || $values->group_action === null) {
			return;
		}

		/**
		 * @todo Define items IDs
		 */
		$http_ids = $form->getHttpData(Form::DATA_LINE | Form::DATA_KEYS, strtolower($this->datagrid->getName()) . '_group_action_item[]');
		$ids = array_keys($http_ids);

		$id = $values->group_action;
		$this->group_actions[$id]->onSelect($ids, isset($values->{$id}) ? $values->{$id} : null);

		$form['group_action']['group_action']->setValue(null);
	}
74250
public function addtocampaign($data, $form)
    {
        $id = $data['ID'];
        $record = \Page::get()->byID($id);

        $handler = AddToCampaignHandler::create($this, $record);
        $results = $handler->addToCampaign($record, $data);
        if (is_null($results)) {
            return null;
        }

        if ($this->getSchemaRequested()) {
            // Send extra "message" data with schema response
            $extraData = ['message' => $results];
            $schemaId = Controller::join_links($this->Link('schema/AddToCampaignForm'), $id);
            return $this->getSchemaResponse($schemaId, $form, null, $extraData);
        }

        return $results;
    }
820821
public function doSaveAddress($data, $form)
    {
        if (!$data["ID"]) {
            $address = MemberAddress::create();
        } else {
            $address = MemberAddress::get()->byID($data["ID"]);
        }

        if ($address) {
            $form->saveInto($address);
            $address->write();

            $this->owner->setSessionMessage(
                "success",
                _t("Checkout.AddressSaved", "Address Saved")
            );
        } else {
            $this->owner->setSessionMessage(
                "error",
                _t("Checkout.Error", "There was an error")
            );
        }

        return $this->owner->redirect($this->owner->Link("addresses"));
    }
899591
public function registerAction()
    {
        $formDef = $this->game->getPlayerForm();
        if ($formDef !== null) {
            $form = $this->getGameService()->createFormFromJson($formDef->getForm(), 'playerForm');
        } else {
            return $this->notFoundAction();
        }

        if ($this->getRequest()->isPost()) {
            // POST Request: Process form
            $data = array_merge_recursive(
                $this->getRequest()->getPost()->toArray(),
                $this->getRequest()->getFiles()->toArray()
            );

            $form->setData($data);

            if ($form->isValid()) {
                // steps of the game
                $steps = $this->game->getStepsArray();
                // sub steps of the game
                $viewSteps = $this->game->getStepsViewsArray();
                $keyStep = false;

                // register position
                $key = array_search($this->params('action'), $viewSteps);
                if ($key === false) {
                    // register is not a substep of the game so it's a step
                    $key     = array_search($this->params('action'), $steps);
                    if ($key !== false) {
                        $keyStep = true;
                    } else {
                        $key = -1;
                    }
                } else {
                    // register was a substep, I search the index of its parent
                    $key     = array_search($key, $steps);
                }

                // play position
                $keyplay = array_search('play', $viewSteps);

                if (!$keyplay) {
                    // play is not a substep, so it's a step
                    $keyplay     = array_search('play', $steps);
                    $keyplayStep = true;
                } else {
                    // play is a substep so I search the index of its parent
                    $keyplay     = array_search($keyplay, $steps);
                    $keyplayStep = false;
                }

                // If register step before play, I don't have no entry yet. I have to create one
                // If register after play step, I search for the last entry created by play step.
                if ($key < $keyplay || ($keyStep && !$keyplayStep && $key <= $keyplay)) {
                    // I need to check if this anonymous user has already played. This one is transmitted through
                    // a cookie... so I need to fill in this cookie if it's not already updated.
                    if ($this->game->getAnonymousAllowed() &&
                        $this->game->getAnonymousIdentifier() &&
                        isset($data[$this->game->getAnonymousIdentifier()])
                    ) {
                        $session = new \Zend\Session\Container('anonymous_identifier');
                        if (empty($session->offsetGet('anonymous_identifier'))) {
                            $anonymousIdentifier = $data[$this->game->getAnonymousIdentifier()];
                        
                            // I must transmit this info during the whole game workflow
                            $session->offsetSet('anonymous_identifier', $anonymousIdentifier);
                        }
                    }
                    $playError = null;
                    $entry = $this->getGameService()->play($this->game, $this->user, $playError);
                    if (!$entry) {
                        $reason = "";
                        if ($playError === -1) {
                            // the user has already taken part to this game and the participation limit has been reached
                            $this->flashMessenger()->addMessage('Vous avez déjà participé');
                            $reason = '?playLimitReached=1';
                            $noEntryRedirect = $this->frontendUrl()->fromRoute(
                                $this->game->getClassType().'/result',
                                array(
                                    'id' => $this->game->getIdentifier(),
                                )
                            ) .$reason;
                        } elseif ($playError === -2) {
                            // the user has not accepted the mandatory rules of the game
                            $this->flashMessenger()->addMessage('Vous devez accepter le réglement');
                            $reason = '?NoOptin=1';
                            $noEntryRedirect = $this->frontendUrl()->fromRoute(
                                $this->game->getClassType(),
                                array(
                                    'id' => $this->game->getIdentifier(),
                                )
                            ) .$reason;
                        } elseif ($playError === -3) {
                            // the user has enough points to buy an entry to this game
                            $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie");
                            $reason = '?NotPaid=1';
                            $noEntryRedirect = $this->frontendUrl()->fromRoute(
                                $this->game->getClassType(),
                                array(
                                    'id' => $this->game->getIdentifier(),
                                )
                            ) .$reason;
                        }

                        return $this->redirect()->toUrl($noEntryRedirect);
                    }
                } else {
                    // I'm looking for an entry without anonymousIdentifier (the active entry in fact).
                    $entry = $this->getGameService()->findLastEntry($this->game, $this->user);
                    if ($this->getGameService()->hasReachedPlayLimit($this->game, $this->user)) {
                        // the user has already taken part of this game and the participation limit has been reached
                        $this->flashMessenger()->addMessage('Vous avez déjà participé');

                        return $this->redirect()->toUrl(
                            $this->frontendUrl()->fromRoute(
                                $this->game->getClassType().'/result',
                                array(
                                    'id' => $this->game->getIdentifier(),
                                )
                            )
                        );
                    }
                }

                $this->getGameService()->updateEntryPlayerForm($form->getData(), $this->game, $this->user, $entry);

                if (!empty($this->game->nextStep($this->params('action')))) {
                    return $this->redirect()->toUrl(
                        $this->frontendUrl()->fromRoute(
                            $this->game->getClassType().'/'.$this->game->nextStep($this->params('action')),
                            array('id'              => $this->game->getIdentifier()),
                            array('force_canonical' => true)
                        )
                    );
                }
            }
        }

        $viewModel = $this->buildView($this->game);
        $viewModel->setVariables(
            array(
                'form' => $form,
            )
        );

        return $viewModel;
    }
456524
public function setActionUrl(Form $form){
        if($provider = $this->findProvider($form)){
            return $provider->setActionUrl($form);
        }
    }
693902
public function RegisterForm()
    {

        // If back URL set, push to session
        if (isset($_REQUEST['BackURL'])) {
            Session::set('BackURL', $_REQUEST['BackURL']);
        }

        $config = Users::config();

        // Setup form fields
        $fields = FieldList::create(
            TextField::create("FirstName"),
            TextField::create("Surname"),
            EmailField::create("Email"),
            $password_field = ConfirmedPasswordField::create("Password")
        );

        $password_field->minLength = $config->get("password_min_length");
        $password_field->maxLength = $config->get("password_max_length");
        $password_field->requireStrongPassword = $config->get("password_require_strong");

        // Setup form actions
        $actions = new FieldList(
            FormAction::create("doRegister", "Register")
                ->addExtraClass("btn")
                ->addExtraClass("btn-green")
        );

        // Setup required fields
        $required = new RequiredFields(
            array(
            "FirstName",
            "Surname",
            "Email",
            "Password"
            )
        );

        $form = Form::create(
            $this,
            "RegisterForm",
            $fields,
            $actions,
            $required
        )->addExtraClass("forms")
        ->addExtraClass("forms-columnar");

        $this->extend("updateRegisterForm", $form);

        $session_data = Session::get("Form.{$form->FormName()}.data");

        if ($session_data && is_array($session_data)) {
            $form->loadDataFrom($session_data);
            Session::clear("Form.{$form->FormName()}.data");
        }

        return $form;
    }
1099122
public function addMockData($data, $form)
    {
        if ($page = SiteTree::get()->byID($data['ID'])) {
            $page->fill(array(
                'only_empty' => true,
                'include_relations' => false,
                'download_images' => false
            ));

            $this->owner->response->addHeader(
                'X-Status',
                'Added mock data'
            );
        }
        
        return $this->owner->getResponseNegotiator()->respond($this->owner->request);
    }
637657
public function doAdd($data, Form $form) {
        $record=$this->getRecord(null);
        $form->saveInto($record);
        $record->write();
        
        $editController=singleton('CodeBank');
        $editController->setCurrentPageID($record->ID);
        
        return $this->redirect(Controller::join_links(singleton('CodeBank')->Link('show'), $record->ID));
    }
569579
public function doRegister($data, $form)
    {
        $r = new EventRegistration();
        $form->saveInto($r);

        $EventDetails = Event::get()->byID($r->EventID);

        if ($EventDetails->TicketsRequired) {
            $r->AmountPaid = ($r->AmountPaid/100);
        }
        $r->write();

        $from = Email::getAdminEmail();
        $to = $r->Email;
        $bcc = $EventDetails->RSVPEmail;
        $subject = "Event Registration - ".$EventDetails->Title." - ".date("d/m/Y H:ia");
        $body = "";

        $email = new Email($from, $to, $subject, $body, null, null, $bcc);
        $email->setTemplate('EventRegistration');
        $email->send();

        exit;
    }
505925
public function doAddMockChildren($data, $form)
    {
        $parentPage = SiteTree::get()->byID((int) $data['ID']);
        if (!$parentPage) {
            return false;
        }
        
        $className = isset($data['PageType']) ? $data['PageType'] : "Page";
        $builder = new MockDataBuilder($className);
        $builder
            ->setCount((int) $data['Count'])
            ->setIncludeRelations((bool) $data['IncludeRelations'])
            ->setDownloadImages((bool) $data['DownloadImages'])
            ->setParentField("ParentID")
            ->setParentObj($parentPage);
        try {
            $ids = $builder->generate();
        } catch (Exception $e) {
            $form->sessionMessage($e->getMessage(), "bad");
            return $this->redirectBack();
        }
        $this->response->addHeader(
            'X-Status',
            _t('MockData.CREATESUCCESS', 'Created {count} mock children under {title}', array('count' => $data['Count'], 'title' => $parentPage->Title))
        );
        $this->redirect(Controller::join_links(singleton('CMSPagesController')->Link()));
        
        return $this->getResponseNegotiator()->respond($this->request);
    }
456901
function registerForms(vm) {
    let forms = vm.$options.forms;

    if (typeof forms == 'object') {
        let dataIsFunction = typeof vm.$options.data == 'function';
        let data = dataIsFunction ? vm.$options.data() : vm.$options.data;

        if (typeof data == 'undefined') {
            data = {};
        }

        for (var form in forms) {
            if (has(data, form)) {
                throw new Error(`The form, ${form}, has a name which is colliding with another form or data property!`)
            }
            data[form] = new Form(forms[form]);
        }

        vm.$options.data = function () { return data };
    }
}
590325
static function registerForm (Form $form)
    {
        if (!in_array($form, self::$forms))
            array_push(self::$forms, $form);
    }
1148598
public function renderFormAction(
        Action $action,
        Request $request,
        FormInterface $form,
        $data = null,
        array $viewParameters = []
    ): Response {
        $viewParameters = array_merge($this->getViewParameters($action, $request, $form, $data), $viewParameters);

        return $this->renderAction($action, $viewParameters);
    }