Frontend\Modules\FormBuilder\Widgets\Form::createAction PHP Method

createAction() private method

We use this function to create the action for the form. This action cannot contain an identifier since these are used for statistics and failed form submits cannot be tracked.
private createAction ( ) : string
return string
    private function createAction()
    {
        // pages
        $action = implode('/', $this->URL->getPages());
        // init parameters
        $parameters = $this->URL->getParameters();
        $moduleParameters = array();
        $getParameters = array();
        // sort by key (important for action order)
        ksort($parameters);
        // loop and filter parameters
        foreach ($parameters as $key => $value) {
            // skip identifier
            if ($key === 'identifier') {
                continue;
            }
            // normal parameter
            if (\SpoonFilter::isInteger($key)) {
                $moduleParameters[] = $value;
            } else {
                // get parameter
                $getParameters[$key] = $value;
            }
        }
        // single language
        if ($this->getContainer()->getParameter('site.multilanguage')) {
            $action = LANGUAGE . '/' . $action;
        }
        // add to action
        if (count($moduleParameters) > 0) {
            $action .= '/' . implode('/', $moduleParameters);
        }
        if (count($getParameters) > 0) {
            $action .= '?' . http_build_query($getParameters, null, '&', PHP_QUERY_RFC3986);
        }
        // remove trailing slash
        $action = rtrim($action, '/');
        // cough up action
        return '/' . $action;
    }