Defines the form for the receiver and dimension fields.

@param Form $form

@return $this
771963
public function setForm($form)
    {
        foreach ($this->fields as $field) {
            $field->setForm($form);
        }
        
        return parent::setForm($form);
    }
779702
protected function configureFormFields(FormMapper $form)
    {
        if ($this->getSubject() == null || $this->getSubject()->getId() === null) {
            $form->add('path', 'text', array('mapped' => false));
        }
        $form->add('alias', 'text');
        $form->add('title', 'text');
        $form->add('keywords', 'text');
        $form->add('description', 'textarea', array());
        $form->add('metatags', 'textarea', array('label' => 'additional metatags'));
        $form->setHelps(array('metatags' => 'help.metatags'));
    }
438210
public function formExtendFields($form)
    {
        $model = $form->model;
        $theme = $this->findThemeObject($model->theme);
        $config = $theme->getFormConfig();

        if ($fields = array_get($config, 'fields')) {
            $form->addFields($fields);
        }

        if ($fields = array_get($config, 'tabs.fields')) {
            $form->addTabFields($fields);
        }

        if ($fields = array_get($config, 'secondaryTabs.fields')) {
            $form->addSecondaryTabFields($fields);
        }
    }
958727
protected function getElementId(Form $form)
    {
        /** @var Form $parent */
        $parent = $form->getParent();
        if (null !== $parent) {
            return $this->getElementId($parent) . '_' . $form->getName();
        } else {
            return $form->getName();
        }
    }
1122923
public function renderForm(Form $form)
	{
		$content = '';
		foreach ($form as $element)
		{
			$content .= $this->render($element);
		}

		$form->setAttribute('role', 'form');

		return Html::tag('form', $form->getAttributes(), $content);
	}
136077
public function transform(FormInterface $form)
    {
        $question = parent::transform($form);
        $question->setHidden(true);

        return $question;
    }
1026931
public function setForm(\Mmi\Form\Form $form)
    {
        //parent
        parent::setForm($form);
        //obiekt niezdefiniowany
        if (!$this->getUploaderObject()) {
            //ustawianie obiektu
            $this->setUploaderObject($form->getFileObjectName());
        }
        //instancja front controllera
        $frontController = \Mmi\App\FrontController::getInstance();
        //uploaderId znajduje się w requescie
        if ($frontController->getRequest()->uploaderId) {
            $this->setOption(self::UPLOADER_ID_KEY, $frontController->getRequest()->uploaderId);
            return $this;
        }
        //przekierowanie na url zawierający nowowygenerowany uploaderId
        $frontController->getResponse()->redirectToUrl($frontController->getView()->url($frontController->getRequest()->toArray() + ['uploaderId' => mt_rand(1000000, 9999999)]));
        return $this;
    }
428135
public function transform(FormInterface $form)
    {
        return new Question($this->questionFrom($form), $this->defaultValueFrom($form));
    }
1234750
public function addReferrerToForm(FormInterface $form): void
    {
        $request = $this->get('request_stack')->getCurrentRequest();
        $form->add('http-referrer', HiddenType::class, [
            'mapped' => false,
            'data' => $request->headers->get('referer'),
        ]);
    }
216185
public function form($form = null)
    {
        if (func_num_args() === 1) {
            $form = $form ?: [];
            $this->_form = $form;
            $this->set($form);
            return $this;
        }
        return $this->_form;
    }
792725
protected function _prepareForm()
    {
        $form = new Varien_Data_Form(array(
            'id' => 'edit_form',
            'action' => $this->getData('action'),
            'method' => 'post'
        ));
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
652863
public function createResult(Form $form)
    {
        $result = new Result();
        $result->setDatetimeAdded(new \DateTime());

        $viewData = $form->getSf2Form()->getViewData();

        foreach ($form->getFields() as $field) {
            $entry = new Entry();
            $entry->setField($field);
            $entry->setValue($viewData['field_'.$field->getId()]);
            $result->addEntry($entry);
        }

        return $result;
    }
1374810
protected function addAnswersFields(FormInterface $form)
    {
        $question = $this->questionInteract->getQuestion();
        $data = $this->getQuestionData();

        /** @var AnswerCheckerInterface $checker */
        $checker = $this->checkerLocator->get($question->getType());
        $options = $checker->getOptions($question->getAnswers()->getValues(), $data);
        $form->add('answers', $checker->getType(), $options);
    }
158401
final public function validate($form)
    {
        $this->initializeValidator($form);

        $formObject = $this->formValidatorExecutor->getFormObject();
        $formObject->markFormAsSubmitted();
        $formObject->setForm($form);

        $this->validateGhost($form, false);

        $formObject->setFormResult($this->result);

        return $this->result;
    }
231623
public function setForm($form)
    {
        foreach ($this->namedLinkCompositeField->compositeDatabaseFields() as $field => $spec) {
            $fieldHandle = 'field' . $field;
            $this->{$fieldHandle}->setForm($form);
        }
//		$this->fieldPageID->setForm($form);
//		$this->fieldPageAnchor->setForm($form);
//		$this->fieldFileID->setForm($form);
//		$this->fieldCustomURL->setForm($form);
//		$this->fieldShortcode->setForm($form);
//		$this->fieldTitle->setForm($form);
//		$this->fieldLinkmode->setForm($form);

		parent::setForm($form);

        return $this;
	}
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;
        }

    }
1241065
public function merge(\sndsgd\Form ...$forms): Form
    {
        foreach ($forms as $form) {
            $fields = array_values($form->getFields());
            $this->addFields(...$fields);
        }

        return $this;
    }