Prepare form layout.
9940
protected function _layoutForm()
    {
        if (!$this->expiresOn) {
            $expiresOn = new AnDate();

            $expiresOn->addMonths(1);

            $this->set(array(
                'expiresOn' => $expiresOn,
            ));
        }
    }
722629
protected function prepare_fields( Form $form ) {
		foreach ( $form->all() as $field ) {
			/* @var $field \WPLibs\Form\Field */
			if ( ! $field->should_show() ) {
				return;
			}

			$_section = $field->get_option( 'section' );

			if ( ! $_section || ! isset( $this->sections[ $_section ] ) ) {
				continue;
			}

			$this->sections[ $_section ]->fields[] = $field;
		}
	}
514259
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Post $post */
        $post = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('publish_fieldset', [
            'class'  => 'blog__post-fieldset',
            'legend' => __('Publish'),
        ]);

        $fieldset->addField('status', 'select', [
            'label'  => __('Status'),
            'name'   => 'post[status]',
            'value'  => $post->getStatus(),
            'values' => $this->status->toOptionArray(),
        ]);

        $fieldset->addField('created_at', 'date', [
            'label'       => __('Published on'),
            'name'        => 'post[created_at]',
            'value'       => $post->getCreatedAt(),
            'date_format' => 'MMM d, y',
            'time_format' => 'h:mm a',
        ]);

        $fieldset->addField('is_pinned', 'checkbox', [
            'label'   => __('Pin post at the top'),
            'name'    => 'post[is_pinned]',
            'value'   => 1,
            'checked' => $post->getIsPinned(),
        ]);

        return parent::_prepareForm();
    }
99294
protected function _layoutEdit()
    {
        $config = new AnConfig(array(
            'date' => $this->item->expiresOn,
        ));

        $this->set(array(
            'expiresOn' => new AnDate($config),
        ));
    }
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);
	}
271967
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Category $category */
        $category = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('edit_fieldset', [
            'legend' => __('Search Engine Optimization')
        ]);

        $fieldset->addField('url_key', 'text', [
            'label' => __('URL Key'),
            'name'  => 'url_key',
            'value' => $category->getUrlKey(),
        ]);

        $fieldset->addField('meta_title', 'text', [
            'label' => __('Meta Title'),
            'name'  => 'meta_title',
            'value' => $category->getMetaTitle(),
        ]);

        $fieldset->addField('meta_description', 'textarea', [
            'label' => __('Meta Description'),
            'name'  => 'meta_description',
            'value' => $category->getMetaDescription(),
        ]);

        $fieldset->addField('meta_keywords', 'textarea', [
            'label' => __('Meta Keywords'),
            'name'  => 'meta_keywords',
            'value' => $category->getMetaKeywords(),
        ]);

        return parent::_prepareForm();
    }
275905
function prepare ( data, useQs ) {
	var ret;
	if ( !('FormData' in global) || useQs ) {
		ret = qs(data);
	} else {
		ret = new FormData();
		for ( var prop in data ) {
			if ( data.hasOwnProperty(prop) ) {
				ret.append(prop, data[prop]);
			}
		}
	}
	return ret;
}
1134021
private void align() {
        mainForm.setLayoutMargin(5);
        mainForm.setWidth100();
        mainForm.setHeight100();
        mainForm.setBackgroundColor("#FFFFFF");
        mainForm.setAlign(Alignment.CENTER);
        mainForm.setLayoutAlign(Alignment.CENTER);
        mainForm.setDefaultLayoutAlign(Alignment.CENTER);
        
        viewPort.setWidth(LAYOUT_WIDTH);
        viewPort.setLayoutAlign(Alignment.CENTER);
        viewPort.setAlign(Alignment.CENTER);
        viewPort.setDefaultLayoutAlign(Alignment.CENTER);
    }
126809
public static function beginFormTb(
        $layout = self::FORM_LAYOUT_VERTICAL,
        $action = '',
        $method = 'post',
        $htmlOptions = array()
    ) {
        if (!empty($layout)) {
            // refactor to not use a switch
            switch ($layout) {
                case self::FORM_LAYOUT_HORIZONTAL:
                    self::addCssClass('form-' . self::FORM_LAYOUT_HORIZONTAL, $htmlOptions);
                    break;
                case self::FORM_LAYOUT_INLINE:
                case self::FORM_LAYOUT_SEARCH:
                    self::addCssClass('form-' . self::FORM_LAYOUT_INLINE, $htmlOptions);
                    break;
                default:
                    self::addCssClass('form-' . $layout, $htmlOptions);
            }
        }
        return parent::beginForm($action, $method, $htmlOptions);
    }
527575
public function prepareVars()
    {
        // Refresh the loaded data to support being modified by filterFields
        // @see https://github.com/octobercms/october/issues/2613
        if (!self::$onAddItemCalled) {
            $this->processExistingItems();
        }

        if ($this->previewMode) {
            foreach ($this->formWidgets as $widget) {
                $widget->previewMode = true;
            }
        }

        $this->vars['indexInputName'] = $this->indexInputName;
        $this->vars['groupInputName'] = $this->groupInputName;

        $this->vars['prompt'] = $this->prompt;
        $this->vars['formWidgets'] = $this->formWidgets;
        $this->vars['titleFrom'] = $this->titleFrom;
        $this->vars['minItems'] = $this->minItems;
        $this->vars['maxItems'] = $this->maxItems;

        $this->vars['useGroups'] = $this->useGroups;
        $this->vars['groupDefinitions'] = $this->groupDefinitions;
    }
920305
def _process_layout(self, layout):
        """"""
        # Here we just group text into paragraphs
        elements = []
        for lt_obj in layout:
            if isinstance(lt_obj, LTTextBox) or isinstance(lt_obj, LTTextLine):
                elements.append(Paragraph(lt_obj.get_text().strip()))
            elif isinstance(lt_obj, LTFigure):
                # Recursive...
                elements.extend(self._process_layout(lt_obj))
        return elements
229469
def render_form(form):
    """"""

    if 'crispy_forms' in settings.INSTALLED_APPS:
        from crispy_forms.templatetags.crispy_forms_filters import as_crispy_form
        return as_crispy_form(form)

    template = get_template("bootstrap/form.html")
    form = _preprocess_fields(form)

    return template.render({"form": form})
966494
protected function prepare()
    {
        $this->initPurifier($this->config->getPurifierCacheLocation());

        $this->oldText = $this->purifyHtml($this->oldText);
        $this->newText = $this->purifyHtml($this->newText);
    }
237759
protected function setupLayout()
    {
        if (isset($this->layout) && !is_null($this->layout)) {
            $data = array();

            // Enter here data that have to be accessible everywhere
            $this->layout = View::make($this->layout, $data);
        }
    }
1010043
protected function preProcess(): void
    {
        Router::process();

        // disable Layout for XmlHttpRequests
        if (Request::isXmlHttpRequest()) {
            $this->layoutFlag = false;
        }

        // switch to JSON response based on Accept header
        if (Request::checkAccept([Request::TYPE_HTML, Request::TYPE_JSON]) === Request::TYPE_JSON) {
            $this->layoutFlag = false;
            Response::setType('JSON');
        }
    }
1116508
public function prepareVars()
    {
        $this->vars['mode'] = $this->mode;
        $this->vars['stretch'] = $this->formField->stretch;
        $this->vars['size'] = $this->formField->size;
        $this->vars['name'] = $this->getFieldName();
        $this->vars['value'] = $this->getLoadValue();
    }
53223
protected function beforeRenderFormType()
    {
        $controller = $this->_controller();

        $controller->set('formEnableDirtyCheck', $this->_getFormEnableDirtyCheck());
        $controller->set('formSubmitButtonText', $this->_getFormSubmitButtonText());
        $controller->set('formSubmitExtraButtons', $this->_getFormSubmitExtraButtons());
        $controller->set('formSubmitExtraLeftButtons', $this->_getFormSubmitExtraLeftButtons());
        $controller->set('formUrl', $this->_getFormUrl());
    }