{@inheritdoc}

Processes "majora.loader_bridge.form" tags
551262
public function process(ContainerBuilder $container)
    {
        $entityCollectionType = $container->getDefinition('majora.loader.bridge.form.type.entity_collection');
        $loaders = $container->findTaggedServiceIds('majora.loader_bridge.form');

        foreach ($loaders as $loaderId => $tags) {
            foreach ($tags as $attributes) {
                if (!isset($attributes['alias'])) {
                    throw new \RuntimeException('Alias required for "majora.loader_bridge.form" tag.');
                }

                $entityCollectionType->addMethodCall(
                    'registerLoader',
                    [$attributes['alias'], new Reference($loaderId)]
                );
            }
        }
    }
481310
public function finishForm(HTML_QuickForm2_Node $form)
    {
        $formTpl = str_replace(
            array('{attributes}', '{hidden}', '{errors}'),
            array($form->getAttributes(true), $this->hiddenHtml,
                  $this->outputGroupedErrors()),
            $this->findTemplate($form, '{content}')
        );
        $this->hiddenHtml = '';

        // required note
        if (!$this->hasRequired || $form->toggleFrozen() ||
            empty($this->options['required_note']))
        {
            $formTpl = preg_replace('!<qf:reqnote>.*</qf:reqnote>!isU', '', $formTpl);
        } else {
            $formTpl = str_replace(
                array('<qf:reqnote>', '</qf:reqnote>', '{reqnote}'),
                array('', '', $this->options['required_note']),
                $formTpl
            );
        }

        $break         = HTML_Common2::getOption('linebreak');
        $script        = $this->getJavascriptBuilder()->__toString();
        $this->html[0] = array((empty($script)? '': $script . $break) . str_replace(
            '{content}', $break . implode($break, $this->html[0]), $formTpl
        ));
    }
552744
function process_form($form, &$preferences){
        if (isset($form->jabber_jabberid) && !empty($form->jabber_jabberid)) {
            $preferences['message_processor_jabber_jabberid'] = $form->jabber_jabberid;
        }
    }
1027213
private function renderForm(Form $form) : string
    {
        $html = '';

        foreach ($form->getComponents() as $component) {
            $html .= $this->renderErrors($component);

            if ($component instanceof Element) {
                $html .= $this->renderElement($component);
            } elseif ($component instanceof Group) {
                foreach ($component->getElements() as $element) {
                    $html .= $this->renderElement($element);
                }
            }
        }

        return $html;
    }
158975
function() {
        var form = this.element.find('form:first');

        if (!form) {
            return;
        }

        this.fireEvent('submit', [form]);

        var options = {
            url: form.attr('action'),
            type: (form.attr('method') || 'post').toUpperCase()
        };

        if (window.FormData) {
            options.processData = false;
            options.contentType = false;
            options.data = new FormData(form[0]);
        } else {
            options.data = form.serialize();
        }

        this.requestData(options);
    }
437657
function handleYield(forms) {
    var yieldType = sl.valueOf(forms[0]); // "yield" or "yield*"
    if (forms.length != 2) {
      forms.error(yieldType + " expects a single expression");
    }
    this.indent += this.indentSize;
    this.transpileSubExpressions(forms);

    var generated = sl.generated();
    generated.push([yieldType, " ", forms[1]]);
    this.indent -= this.indentSize;
    return generated;
}
899323
function validateForm(form, cb) {

  async.series([function(callback) {
    fs.exists(form, function(exists) {
      if (exists) {
        callback(null);
      } else {
        callback('File ' + path.basename(form) + ' referenced by metadata.json does not exists');
      }
    });
  },
    function(callback) {
      validateJSonStructure(form, callback);
    }
  ], function(err, data) {
    cb(err, data);
  });
}
565929
function form () {
  form.form = $("#swagger-parser-form");

  form.allow = {
    label: form.form.find("#allow-label"),
    menu: form.form.find("#allow-menu"),
    json: form.form.find("input[name=allow-json]"),
    yaml: form.form.find("input[name=allow-yaml]"),
    text: form.form.find("input[name=allow-text]"),
    empty: form.form.find("input[name=allow-empty]"),
    unknown: form.form.find("input[name=allow-unknown]")
  };

  form.refs = {
    label: form.form.find("#refs-label"),
    menu: form.form.find("#refs-menu"),
    external: form.form.find("input[name=refs-external]"),
    circular: form.form.find("input[name=refs-circular]")
  };

  form.validate = {
    label: form.form.find("#validate-label"),
    menu: form.form.find("#validate-menu"),
    schema: form.form.find("input[name=validate-schema]"),
    spec: form.form.find("input[name=validate-spec]")
  };

  form.tabs = {
    url: form.form.find("#url-tab"),
    text: form.form.find("#text-tab")
  };

  form.method = {
    button: form.form.find("button[name=method]"),
    menu: form.form.find("#method-menu")
  };

  form.samples = {
    url: {
      container: form.form.find("#url-sample"),
      link: form.form.find("#url-sample-link"),
    },
    text: {
      container: form.form.find("#text-sample"),
      link: form.form.find("#text-sample-link"),
    }
  };

  form.url = form.form.find("input[name=url]");
  form.textBox = null; // This is set in editors.js
  form.bookmark = form.form.find("#bookmark");
}
349032
public function indexAction($form = null)
    {
        $form = $form ?: $this->createForm(BasketType::class, $this->get('sonata.basket'), [
            'validation_groups' => ['elements'],
        ]);

        // always validate the basket
        if (!$form->isSubmitted()) {
            if ($violations = $this->get('validator')->validate($form)) {
                $violationMapper = new ViolationMapper();
                foreach ($violations as $violation) {
                    $violationMapper->mapViolation($violation, $form, true);
                }
            }
        }

        $this->get('session')->set('sonata_basket_delivery_redirect', 'sonata_basket_delivery_address');

        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_index_title', [], 'SonataBasketBundle'));

        return $this->render('SonataBasketBundle:Basket:index.html.twig', [
            'basket' => $this->get('sonata.basket'),
            'form' => $form->createView(),
        ]);
    }
66821
public function getJsValidator($form = null, $onLoad = true, $wrapped = true)
    {
        if ($form instanceof FormView) {
            $form = $form->vars['name'];
        }
        $jsModels = $this->getFactory()->getJsValidatorString($form, $onLoad);
        if ($wrapped) {
            $jsModels = '<script type="text/javascript">' . $jsModels . '</script>';
        }

        return $jsModels;
    }
689971
private void processTag(final StringBuilder builder) {
        boolean started = false;
        while (templateReader.hasNextCharacter()) {
            final char tagCharacter = templateReader.nextCharacter();
            // Stripping whitespaces at the beginning of the tag data:
            if (!started && Strings.isWhitespace(tagCharacter)) {
                continue;
            }
            started = true;
            if (tagCharacter == syntax.getArgumentOpening()) {
                // LML parser argument inside a tag. We want to convert these.
                processArgument();
            } else if (tagCharacter == syntax.getTagOpening() && isNextCharacterCommentOpening()) {
                // Comment inside a tag. Removing its content.
                processComment();
            } else if (tagCharacter == syntax.getTagClosing()) {
                // We're being closed.
                processTagEntity(builder);
                return;
            } else {
                builder.append(tagCharacter);
            }
        }
        throwError("Unclosed tag: " + builder.toString());
    }
670659
protected function addStepElementsForStep4(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model) {
        // Things go really wrong (at the session level) if we run this code
        // while the finish button was pressed
        if ($this->isFinishedClicked()) {
            return;
        }

        $this->nextDisabled = true;
        
        $batch = $this->getUpdateBatch();
        $form  = $bridge->getForm();

        $batch->setFormId($form->getId());
        $batch->autoStart = true;

        // \MUtil_Registry_Source::$verbose = true;
        if ($batch->run($this->request)) {
            exit;
        }

        $element = $form->createElement('html', $batch->getId());

        if ($batch->isFinished()) {
            // Keep the filename after $batch->getMessages(true) cleared the previous
            $this->addMessage($batch->getMessages(true));
            $element->h3($this->_('Survey replaced successfully!'));
            $this->nextDisabled = false;

            $data = $this->formData;
            // Remove unuseful data
            unset($data['button_spacer'], $data['current_step'], $data[$this->csrfId], $data['auto_form_focus_tracker'], $data['import_id']);
            // Add friendly names
            $data['source_survey_name'] =  $this->getSurveyName($this->sourceSurveyId);
            $data['target_survey_name'] =  $this->getSurveyName($this->targetSurveyId);
            $this->accesslog->logChange($this->request, null, array_filter($data));
        } else {
            $element->setValue($batch->getPanel($this->view, $batch->getProgressPercentage() . '%'));
        }

        $form->activateJQuery();
        $form->addElement($element);
    }
551970
function(forms) {
    var opName = sl.valueOf(forms[0]);
    if (forms.length < 2)  {
      forms.error("missing argument for unary operator: " + opName);
    }

    this.transpileSubExpressions(forms)
    var generated = sl.generated();
    var postPrefix = "post";
    if(opName.indexOf(postPrefix) === 0) {
      generated.push([sl.valueOf(forms[1]),opName.substring(postPrefix.length)]);
    }
    else {
      generated.push([forms[0], sl.valueOf(forms[1])]);
    }
    generated.callable = false;
    return generated;
}
98356
protected function prepareForm(Form $form)
	{
		$form->getElementPrototype()->class[] = 'form-horizontal';
		$translator = $form->getTranslator();
		foreach ($form->controls as $control) {
			/** @var BaseControl $control */
			if ($control instanceof HiddenField) {
				continue;
			} elseif ($control instanceof Button) {
				$control->controlPrototype->class[] = "btn-block btn-lg";
			} else {
				if ($control->getLabel()) {
					$control->setAttribute('placeholder', $control->caption);
					if (empty($control->controlPrototype->attrs['title'])) {
						$control->setAttribute('title', $translator ? $translator->translate($control->caption) : $control->caption);
					}
					$control->getLabelPrototype()->attrs["style"] = "display:none";
				}
			}
		}
		BootstrapHelper::ApplyBootstrapToControls($form);
	}
479360
function render() {
		if ($this->show_metainfo) {
			$this->appendtagbody($this->hidden('form')
				->value_is($this->signature()));
		}

		return parent::render();
	}
508012
protected function addStepGenerateExportFile(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
    {
        // Things go really wrong (at the session level) if we run this code
        // while the finish button was pressed
        if ($this->isFinishedClicked()) {
            return;
        }
        $this->displayHeader($bridge, $this->_('Creating the export file'), 'h3');

        $this->nextDisabled = true;

        $batch = $this->getExportBatch();
        $form  = $bridge->getForm();

        $batch->setFormId($form->getId());
        $batch->autoStart = true;

        // \MUtil_Registry_Source::$verbose = true;
        if ($batch->run($this->request)) {
            exit;
        }

        $element = $form->createElement('html', $batch->getId());

        if ($batch->isFinished()) {
            $this->nextDisabled = $batch->getCounter('export_errors');
            $batch->autoStart   = false;

            // Keep the filename after $batch->getMessages(true) cleared the previous
            $downloadName  = \MUtil_File::cleanupName($this->trackEngine->getTrackName()) . '.track.txt';
            $localFilename = $batch->getSessionVariable('filename');

            $this->addMessage($batch->getMessages(true));
            $batch->setSessionVariable('downloadname', $downloadName);
            $batch->setSessionVariable('filename', $localFilename);

            // Log Export
            $data = $this->formData;
            // Remove unuseful data
            unset($data['button_spacer'], $data['current_step'], $data[$this->csrfId]);
            // Add useful data
            $data['localfile']    = '...' . substr($localFilename, -30);
            $data['downloadname'] = $downloadName;
            ksort($data);
            $this->accesslog->logChange($this->request, null, array_filter($data));

            if ($this->nextDisabled) {
                $element->pInfo($this->_('Export errors occurred.'));
            } else {
                $p = $element->pInfo($this->_('Export file generated.'), ' ');
                $p->sprintf(
                        $this->plural(
                                'Click here if the download does not start automatically in %d second:',
                                'Click here if the download does not start automatically in %d seconds:',
                                $this->downloadWaitSeconds
                                ),
                        $this->downloadWaitSeconds
                        );
                $p->append(' ');

                $href = new \MUtil_Html_HrefArrayAttribute(array('file' => 'go', $this->stepFieldName => 'download'));
                $p->a(
                        $href,
                        $downloadName,
                        array('type' => 'application/download')
                        );

                $metaContent = sprintf('%d;url=%s', $this->downloadWaitSeconds, $href->render($this->view));
                $this->view->headMeta($metaContent, 'refresh', 'http-equiv');
            }

        } else {
            $element->setValue($batch->getPanel($this->view, $batch->getProgressPercentage() . '%'));

        }
        $form->activateJQuery();
        $form->addElement($element);
    }
49008
private function serializeForm(Form $form)
    {
        $result = $children = [];
        $errors = iterator_to_array($form->getErrors());

        foreach ($form as $child) {
            if ($child instanceof Form) {
                $children[$child->getName()] = $this->serializeForm($child);
            }
        }

        if (!empty($errors)) {
            $result['errors'] = $errors;
        }

        if (!empty($children)) {
            $result['children'] = $children;
        }

        return $result;
    }