Embeds the supplied staged form within the current staged form.

@param IStagedForm $embeddedForm

@return StagedForm
487611
public function embed(IStagedForm $embeddedForm) : StagedForm
    {
        foreach ($embeddedForm->getAllStages() as $stage) {
            $this->followingStages[] = $stage;
        }

        return $this;
    }
440535
private function createFormView(FormInterface $form)
    {
        $themes = $this->getParameterResolver()->resolveThemes();
        $view = $form->createView();

        if (!empty($themes)) {
            $this->formRenderer->setTheme($view, $themes);
        }

        return $view;
    }
216185
public function form($form = null)
    {
        if (func_num_args() === 1) {
            $form = $form ?: [];
            $this->_form = $form;
            $this->set($form);
            return $this;
        }
        return $this->_form;
    }
136077
public function transform(FormInterface $form)
    {
        $question = parent::transform($form);
        $question->setHidden(true);

        return $question;
    }
493619
public function & SetForm (\MvcCore\Ext\Forms\IForm & $form) {
		$this->form = & $form;
		return $this;
	}
312574
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addHidden('parent');

		$form->addCheckbox('isLink', 'webManager.web.pages.isLink')
			->setOption('id', 'page-isLink')
			->addCondition($form::EQUAL, false)
			->toggle('page-title')
			->toggle('page-keywords')
			->toggle('page-image')
			->toggle('page-background')
			->toggle('page-description')
			->toggle('page-content')
			->toggle('page-homePage');

		$homePage = $form->addCheckbox('homePage', 'webManager.web.pages.homePage')
			->setOption('id', 'page-homePage')
			->setDisabled(!$this->editHomePage);
		$homePage->addCondition($form::EQUAL, false)
			->toggle('page-name')
			->toggle('page-url')
			->toggle('page-views')
			->toggle('page-isLink');
		if ($homePage->isDisabled()) {
			$homePage->setOption('class', 'hidden');
		}

		$form->addText('name', 'webManager.web.pages.name')
			->setOption('id', 'page-name')
			->addConditionOn($form['homePage'], $form::EQUAL, false)
			->setRequired();

		$form->addText('url', 'default.url')
			->setOption('id', 'page-url')
			->addConditionOn($form['isLink'], $form::EQUAL, true)
			->setRequired();

		$form->addSelectUntranslated('locale', 'webManager.web.pages.locale')
			->setItems($this->localeService->allowed);

		$form->addCheckboxListUntranslated('views', 'webManager.web.pages.views.title')
			->setOption('id', 'page-views')
			->setItems($this->orm->pagesViews->fetchPairsById());

		$form->addText('title', 'webManager.web.pages.pageTitle')
			->setOption('id', 'page-title')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 150);

		$form->addTextArea('keywords', 'webManager.web.pages.keywords')
			->setOption('id', 'page-keywords')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addImageUpload('image', 'webManager.web.pages.photo', 'webManager.web.pages.photoDelete')
			->setNamespace('pages')
			->setPreview('300x100')
			->setOption('id', 'page-image');

		$form->addColor('background', 'webManager.web.pages.background')
			->setOption('id', 'page-background');

		$form->addTextArea('description', 'webManager.web.pages.description')
			->setOption('id', 'page-description')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addTextEditor('content', 'webManager.web.pages.content')
			->setOption('id', 'page-content');

		$form->addSubmit('save', 'form.save');

		$form->addLink('back', 'form.back', $this->getBacklink());

		$form->onSuccess[] = [$this, 'editFormSucceeded'];

		return $form;
	}
962957
function LinkForm() {
		Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
		Requirements::javascript(ExternalContentAdmin::$directory . "/javascript/external_tiny_mce_improvements.js");

		$form = new Form(
			$this->controller,
			"{$this->name}/LinkForm",
			new FieldSet(
				new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close').'" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.LINK', 'Link') . '</h2>'),
				new OptionsetField(
					'LinkType',
					_t('HtmlEditorField.LINKTO', 'Link to'),
					array(
						'internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'),
						'external' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'),
						'anchor' => _t('HtmlEditorField.LINKANCHOR', 'Anchor on this page'),
						'email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'),
						'file' => _t('HtmlEditorField.LINKFILE', 'Download a file'),
						'externalcontent' =>_t('HtmlEditorField.LINKEXTERNALCONTENT', 'External Content'),
					)
				),
				new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'ID', 'MenuTitle'),
				new TextField('external', _t('HtmlEditorField.URL', 'URL'), 'http://'),
				new EmailField('email', _t('HtmlEditorField.EMAIL', 'Email address')),
				new TreeDropdownField('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'Filename'),
				new ExternalTreeDropdownField('externalcontent', _t('ExternalHtmlEditorField.EXTERNAL_CONTENT', 'External Content'), 'ExternalContentSource', 'Link()'),
				new TextField('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')),
				new TextField('LinkText', _t('HtmlEditorField.LINKTEXT', 'Link text')),
				new TextField('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')),
				new CheckboxField('TargetBlank', _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?'))
			),
			new FieldSet(
				new FormAction('insert', _t('HtmlEditorField.BUTTONINSERTLINK', 'Insert link')),
				new FormAction('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))
			)
		);

		$form->loadDataFrom($this);

		return $form;
	}
1019977
public function setForm(Form $form)
	{
		$this->form = $form;
		$this->formControl = $form->getFormControl();

		return $this;
	}
1140039
public function createDraftValueSelection(FetchDraftStmtBuilder $selectDraftStmtBuilder, DraftManager $dm,
			N2nContext $n2nContext): DraftValueSelection {
		return new EmbeddedToOneDraftValueSelection($selectDraftStmtBuilder->requestColumn(EiPropPath::from($this)),
				$dm, $this->eiPropRelation->getTargetEiMask()->getDraftDefinition());
	}
907781
public static function begin($firstStageForm) : StagedForm
    {
        $firstStage = self::parseStage($firstStageForm);

        if (!($firstStage instanceof IndependentFormStage)) {
            throw InvalidArgumentException::format(
                    'Invalid form stage argument: first stage must be independent, callable with required parameter given'
            );
        }

        return new self($firstStage);
    }
771963
public function setForm($form)
    {
        foreach ($this->fields as $field) {
            $field->setForm($form);
        }
        
        return parent::setForm($form);
    }
531830
public function resolve(FormInterface $form)
    {
        $types = FormUtil::typeAncestry($form);

        foreach ($types as $type) {
            if (isset($this->transformers[$type])) {
                return $this->transformers[$type];
            }
        }

        throw new CouldNotResolveTransformer(
            sprintf(
                'Could not find a transformer for any of these types (%s)',
                implode(', ', $types)
            )
        );
    }
111531
public function form(Form $form)
    {
        if ($this->mode == self::MODE_INLINE || $this->mode == self::MODE_INLINE_NO_LABELS) {
            $form->addClass('form-inline');
        } elseif ($this->mode == self::MODE_HORIZONTAL) {
            $form->addClass('form-horizontal');
        }

        return parent::form($form);
    }
1281601
public function DeliveryForm()
    {
        $form = DeliveryDetailsForm::create($this, 'DeliveryForm');

        $data = Session::get("Checkout.DeliveryDetailsForm.data");
        if (is_array($data)) {
            $form->loadDataFrom($data);
        }

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

        return $form;
    }
536057
public function withFormData(IForm $form)
    {
        call_user_func($this->callback, new FormDataWidget($this->name, $this->label, $this->authSystem, $this->requiredPermissions, $form));
    }
598057
public function buildView(BaseForm $form)
    {
        if (null === $this->parser) {
            throw new LogicException(sprintf("You must inject a parser before call %s", __METHOD__));
        }

        return $this->parser->render("form-field/render-string-vector.html", [
            "form" => $form,
            "field_name" => $this->getName(),
            "filtered_name" => str_replace(".", "-", $this->getName()),
        ]);
    }
228417
public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#title'] = $this->t('Configure Presto functionality');

    // Clear any module success messages.
    drupal_get_messages('status');

    // Add configuration forms for optional deps if defined.
    $optionalDeps = $this->optionalDependencyManager->getDefinitions();
    $form['optional_dependencies'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Optional Dependencies'),
      '#collapsible' => FALSE,
      '#tree' => TRUE,
    ];

    $hasOptionalDepsForm = FALSE;
    $form_state->set('optional_dependencies', []);
    foreach ($optionalDeps as $optionalDep) {
      /** @var \Drupal\presto\Installer\OptionalDependencies\OptionalDependencyInterface $instance */
      $instance = $this->optionalDependencyManager->createInstance(
        $optionalDep['id']
      );

      $pluginForm = [];
      $subFormState = SubformState::createForSubform(
        $pluginForm,
        $form,
        $form_state
      );
      $form['optional_dependencies'][$optionalDep['id']] = $instance->buildConfigurationForm(
        $pluginForm,
        $subFormState
      );

      if (count($form['optional_dependencies'][$optionalDep['id']]) > 0) {
        $hasOptionalDepsForm = TRUE;
      }

      $form_state->set(['optional_dependencies', $optionalDep['id']], $instance);
    }

    // Hide optional dependencies fieldset if the config form is empty.
    $form['optional_dependencies']['#access'] = $hasOptionalDepsForm;

    $form['ecommerce'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('eCommerce'),
      '#collapsible' => FALSE,
    ];

    // Only enable commerce if this profile was installed via Composer
    // (which is when the below interface will exist).
    $enableCommerce = FALSE;
    /** @noinspection ClassConstantCanBeUsedInspection */
    if (interface_exists('CommerceGuys\Intl\Currency\CurrencyInterface')) {
      $enableCommerce = TRUE;
    }

    if (!$enableCommerce) {
      $disabledMsg = $this->t('<p><strong>Not supported.</strong></p><p>Unfortunately, eCommerce is only supported if you install Presto via Composer. <a href=":url">See the README for more information on installing via Composer.</a></p>', [
        ':url' => 'https://github.com/Sitback/presto#installing-presto',
      ]);
      $form['ecommerce']['disabled_info'] = [
        '#type' => 'markup',
        '#markup' => $disabledMsg,
      ];
    }

    $form['ecommerce']['enable_ecommerce'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable eCommerce'),
      '#description' => $this->t(
        'Enables Drupal Commerce and some sane defaults to help you kickstart your eCommerce site.'
      ),
      '#disabled' => !$enableCommerce,
      '#default_value' => $enableCommerce,
    ];

    $form['ecommerce']['ecommerce_install_demo_content'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Install Demo Content'),
      '#description' => $this->t(
        'Creates a few demo products to help you test your new eCommerce site.'
      ),
      '#disabled' => !$enableCommerce,
      '#default_value' => $enableCommerce,
      '#states' => [
        'visible' => [
          'input[name="enable_ecommerce"]' => [
            'checked' => TRUE,
          ],
        ],
        'unchecked' => [
          'input[name="enable_ecommerce"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ];

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save and continue'),
      '#button_type' => 'primary',
      '#submit' => ['::submitForm'],
    ];

    return $form;
  }