Return a {@link Form} instance allowing a user to
add links in the TinyMCE content editor.

@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;
	}
746922
public function EditForm() {
		// make sure to load fresh from db
		$record = DataObject::get_by_id('WikiPage', $this->data()->ID);
		$formatter = $record->getFormatter();

		$editorField = $formatter->getEditingField($record);
		$helpLink = $formatter->getHelpUrl();


		$fields = FieldList::create(
						new LiteralField('Preview', '<div data-url="'.$this->Link('livepreview').'" id="editorPreview"></div>'),
						new LiteralField('DialogContent', '<div id="dialogContent" style="display:none;"></div>'),
						$editorField,
						new DropdownField('EditorType', _t('WikiPage.EDITORTYPE', 'Editor Type'), $this->data()->getEditorTypeOptions()),
						new HiddenField('LockUpdate', '', $this->data()->Link('updatelock')),
						new HiddenField('LockLength', '', $this->config()->get('lock_time') - 10)
		);
		

		if ($helpLink) {
			$fields->push(new LiteralField('HelpLink', '<a target="_blank" href="' . $helpLink . '">' . _t('WikiPage.EDITOR_HELP_LINK', 'Editor Help') . '</a>'));
		}

		$actions = null;
		if (!WikiPage::$auto_publish) {
			$actions = FieldList::create(
							new FormAction('save', _t('WikiPage.SAVE', 'Save')),
							new FormAction('done', _t('WikiPage.DONE', 'Done (Draft)')),
							new FormAction('publish', _t('WikiPage.PUBLISH', 'Publish'))
			);
		} else {
			$actions = FieldList::create(
							new FormAction('save', _t('WikiPage.SAVE', 'Save')),
							new FormAction('publish', _t('WikiPage.FINISHED', 'Finished'))
			);
		}

		$actions->push(new FormAction('cancel', _t('WikiPage.CANCEL_EDIT', 'Cancel')));
		$actions->push(new FormAction('revert', _t('WikiPage.REVERT_EDIT', 'Revert')));

		if (Permission::check(MANAGE_WIKI_PAGES)) {
			$actions->push(new FormAction('addpage_t', _t('WikiPage.ADD_PAGE', 'New Page')));
			$actions->push(new FormAction('delete', _t('WikiPage.DELETE_PAGE', 'Delete Page')));
		}

		$form = new Form($this, "EditForm", $fields, $actions);
		$form->loadDataFrom($record);
        
        $this->extend('updateWikiEditForm', $form);
		return $form;
	}
1087374
private FormLayout initForm() {

        FormLayout form = new FormLayout();
        form.setWidth("100%");
        m_targetPath = new CmsPathSelectField();
        m_targetPath.setCaption(
            CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_TARGET_0));
        m_targetPath.setFileSelectCaption(
            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_SELECT_TARGET_CAPTION_0));
        m_targetPath.setResourceFilter(CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireFolder());
        m_targetPath.setWidth("100%");
        form.addComponent(m_targetPath);

        if (m_dialogMode != DialogMode.move) {
            m_actionCombo = new ComboBox();
            m_actionCombo.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_COPYPAGE_COPY_MODE_0));
            m_actionCombo.setNullSelectionAllowed(false);
            m_actionCombo.setNewItemsAllowed(false);
            m_actionCombo.setWidth("100%");
            if (m_context.getResources().size() == 1) {
                if (m_context.getResources().get(0).isFile()) {
                    m_actionCombo.addItem(Action.copy_all);
                    m_actionCombo.setItemCaption(
                        Action.copy_all,
                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_AS_NEW_0));
                    m_actionCombo.addItem(Action.copy_sibling_all);
                    m_actionCombo.setItemCaption(
                        Action.copy_sibling_all,
                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_CREATE_SIBLING_0));
                    if (m_dialogMode == DialogMode.copy_and_move) {
                        m_actionCombo.addItem(Action.move);
                        m_actionCombo.setItemCaption(
                            Action.move,
                            CmsVaadinUtils.getMessageText(
                                org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_FILE_0));
                    }
                } else {
                    CmsResource folder = m_context.getResources().get(0);
                    m_hasContainerPageDefaultFile = hasContainerPageDefaultFile(folder);
                    if (m_hasContainerPageDefaultFile) {
                        m_actionCombo.addItem(Action.container_page_automatic);
                        m_actionCombo.setItemCaption(
                            Action.container_page_automatic,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_AUTOMATIC_0));
                        m_actionCombo.addItem(Action.container_page_copy);
                        m_actionCombo.setItemCaption(
                            Action.container_page_copy,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_CONTAINERPAGE_COPY_0));
                        m_actionCombo.addItem(Action.container_page_reuse);
                        m_actionCombo.setItemCaption(
                            Action.container_page_reuse,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_CONTAINERPAGE_REUSE_0));
                    }
                    if (CmsResourceTypeFolderSubSitemap.isSubSitemap(folder)) {
                        m_actionCombo.addItem(Action.sub_sitemap);
                        m_actionCombo.setItemCaption(
                            Action.sub_sitemap,
                            CmsVaadinUtils.getMessageText(Messages.GUI_COPY_MOVE_SUBSITEMAP_0));
                    }
                    m_actionCombo.addItem(Action.copy_sibling_mixed);
                    m_actionCombo.setItemCaption(
                        Action.copy_sibling_mixed,
                        CmsVaadinUtils.getMessageText(
                            org.opencms.workplace.commons.Messages.GUI_COPY_ALL_NO_SIBLINGS_0));
                    m_actionCombo.addItem(Action.copy_all);
                    m_actionCombo.setItemCaption(
                        Action.copy_all,
                        CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_0));
                    m_actionCombo.addItem(Action.copy_sibling_all);
                    m_actionCombo.setItemCaption(
                        Action.copy_sibling_all,
                        CmsVaadinUtils.getMessageText(
                            org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_CREATE_SIBLINGS_0));
                    if (m_dialogMode == DialogMode.copy_and_move) {
                        m_actionCombo.addItem(Action.move);
                        m_actionCombo.setItemCaption(
                            Action.move,
                            CmsVaadinUtils.getMessageText(
                                org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_FOLDER_0));
                    }
                }
            } else {
                m_actionCombo.addItem(Action.copy_sibling_mixed);
                m_actionCombo.setItemCaption(
                    Action.copy_sibling_mixed,
                    CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_NO_SIBLINGS_0));
                m_actionCombo.addItem(Action.copy_all);
                m_actionCombo.setItemCaption(
                    Action.copy_all,
                    CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_ALL_0));
                m_actionCombo.addItem(Action.copy_sibling_all);
                m_actionCombo.setItemCaption(
                    Action.copy_sibling_all,
                    CmsVaadinUtils.getMessageText(
                        org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_CREATE_SIBLINGS_0));
                if (m_dialogMode == DialogMode.copy_and_move) {
                    m_actionCombo.addItem(Action.move);
                    m_actionCombo.setItemCaption(
                        Action.move,
                        CmsVaadinUtils.getMessageText(
                            org.opencms.workplace.commons.Messages.GUI_COPY_MOVE_MOVE_RESOURCES_0));
                }
            }
            m_actionCombo.setItemStyleGenerator(new ItemStyleGenerator() {

                private static final long serialVersionUID = 1L;

                public String getStyle(ComboBox source, Object itemId) {

                    String style = null;
                    if (m_defaultActions.contains(itemId)) {
                        style = "bold";
                    }
                    return style;
                }
            });
            form.addComponent(m_actionCombo);
            m_actionCombo.addValueChangeListener(event -> updateOverwriteExisting());
        }

        if (m_context.getResources().size() > 1) {
            m_overwriteExisting = new CheckBox(
                CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_COPY_MULTI_OVERWRITE_0));
            m_overwriteExisting.setValue(Boolean.FALSE);
            form.addComponent(m_overwriteExisting);

            updateOverwriteExisting();
        }

        return form;
    }
885248
public function uploadModalAction()
    {
        $destinations = $this->get('claroline.manager.resource_manager')->getDefaultUploadDestinations();

        return array(
            'form' => $this->get('form.factory')->create(new TinyMceUploadModalType($destinations))->createView()
        );
    }
788631
public function form()
    {
        $menuModel = config('admin.database.menu_model');
        $permissionModel = config('admin.database.permissions_model');
        $roleModel = config('admin.database.roles_model');

        $form = new Form(new $menuModel());

        $form->display('id', 'ID');

        $form->select('parent_id', trans('admin.parent_id'))->options($menuModel::selectOptions());
        $form->text('title', trans('admin.title'))->rules('required');
        $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp());
        $form->text('uri', trans('admin.uri'));
        $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
        if ($form->model()->withPermission()) {
            $form->select('permission', trans('admin.permission'))->options($permissionModel::pluck('name', 'slug'));
        }

        $form->display('created_at', trans('admin.created_at'));
        $form->display('updated_at', trans('admin.updated_at'));

        return $form;
    }
795372
public function AddForm() {
		$classes = ClassInfo::subclassesFor(self::$tree_class);
		array_shift($classes);

		foreach ($classes as $key => $class) {
			if (!singleton($class)->canCreate())
				unset($classes[$key]);
			$classes[$key] = FormField::name_to_label($class);
		}

		$fields = new FieldList(
			new HiddenField("ParentID"),
			new HiddenField("Locale", 'Locale', i18n::get_locale()),
			$type = new DropdownField("ProviderType", "", $classes)
		);
		$type->setAttribute('style', 'width:150px');

		$actions = new FieldList(
			FormAction::create("addprovider", _t('ExternalContent.CREATE', "Create"))
				->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
				->setUseButtonTag(true)
		);

		$form = new Form($this, "AddForm", $fields, $actions);

		$form->addExtraClass('cms-edit-form ' . $this->BaseCSSClasses());
		$this->extend('updateEditForm', $form);

		return $form;
	}
740559
public function getMoveForm()
    {
        $id = $this->getRequest()->param('ItemID');
        $scaffolder = Injector::inst()->get(MoveFormFactory::class);

        $form = $scaffolder->getForm($this, 'moveForm', ['FolderID' => $id]);
        $form->setRequestHandler(
            LeftAndMainFormRequestHandler::create($form, [ $id ])
        );

        return $form;
    }
682054
protected JComponent createFormControl() {
        TableFormBuilder formBuilder = new TableFormBuilder( getBindingFactory() );
        usernameField = formBuilder.add( LoginDetails.PROPERTY_USERNAME )[1];
        formBuilder.row();
        passwordField = formBuilder.addPasswordField( LoginDetails.PROPERTY_PASSWORD )[1];
        return formBuilder.getForm();
    }
435191
public function form()
    {
        return $this->scaffoldForm()
                    ->without(['slug'])
                    ->update('parent_id', function (FormElement $element) {
                        $control = new Select('parent_id');
                        $control->setOptions(['' => '--Select--'] + pages()->lists());

                        return $element->setInput($control);
                    });
    }
993949
public function EditorExternalLink()
    {
        // Show link text field if requested
        $showLinkText = $this->controller->getRequest()->getVar('requireLinkText');
        $factory = EditorExternalLinkFormFactory::singleton();
        return $factory->getForm(
            $this->controller,
            "{$this->name}/EditorExternalLink",
            [ 'RequireLinkText' => isset($showLinkText) ]
        );
    }
684166
public function form()
    {
        return Admin::form(Permission::class, function (Form $form) {
            $form->display('id', 'ID');

            $form->text('slug', trans('admin.slug'))->rules('required');
            $form->text('name', trans('admin.name'))->rules('required');

            $form->multipleSelect('http_method', trans('admin.http.method'))
                ->options($this->getHttpMethodsOptions())
                ->help(trans('admin.all_methods_if_empty'));
            $form->textarea('http_path', trans('admin.http.path'));

            $form->display('created_at', trans('admin.created_at'));
            $form->display('updated_at', trans('admin.updated_at'));
        });
    }
42277
protected function createComponentUserForm(): Form
	{
		$form = $this->formFactory->create();
		$form->setAjaxRequest();

		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setDisabled()
			->setDefaultValue($this->profile->username);
		$form->addText('roles', 'cms.permissions.roles')
			->setDisabled()
			->setDefaultValue(implode(', ', $this->profile->roleTitles));
		$form->addText('firstName', 'cms.user.firstName')
			->setDefaultValue($this->profile->firstName);
		$form->addText('surname', 'cms.user.surname')
			->setDefaultValue($this->profile->surname);
		$form->addText('email', 'cms.user.email')
			->setDefaultValue($this->profile->email)
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone')
			->setDefaultValue($this->profile->phone);

		$language = $form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');
		$locale = $this->localeService->get($this->profile->language);
		if ($locale) {
			$language->setDefaultValue($locale->id);
		}

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

		$form->onError[] = function (Form $form) {
			if ($this->isAjax()) {
				$this->redrawControl('userForm');
			}
		};

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

		return $form;
	}
782403
public DialogPage addForm(Form form) {
		DialogPage page = createDialogPage(form);
		addPage(page);
		return page;
	}
259434
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addText('name', 'default.name')
			->setRequired();

		if ($this->editConst) {
			$form->addText('const', 'webManager.web.content.const')
				->setRequired();

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

		$form->addText('title', 'webManager.web.content.contentTitle')
			->addRule(Form::MAX_LENGTH, null, 150)
			->setRequired(false);

		$form->addTextArea('keywords', 'webManager.web.content.keywords');

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

		$form->addColor('background', 'webManager.web.content.background');

		$form->addTextArea('description', 'webManager.web.content.description');

		$form->addTextEditor('content', 'webManager.web.content.content');

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

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

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

		return $form;
	}
1168692
private FormLayout initForm() {

        FormLayout form = new FormLayout();
        form.setWidth("100%");

        IndexedContainer sites = CmsVaadinUtils.getAvailableSitesContainer(m_context.getCms(), CAPTION_PROPERTY);
        m_siteComboBox = prepareComboBox(sites, org.opencms.workplace.Messages.GUI_LABEL_SITE_0);
        m_siteComboBox.select(m_context.getCms().getRequestContext().getSiteRoot());
        form.addComponent(m_siteComboBox);
        ValueChangeListener changeListener = new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

            public void valueChange(ValueChangeEvent event) {

                submit();
            }
        };
        m_siteComboBox.addValueChangeListener(changeListener);
        return form;
    }
841392
public function toolModalContentAction()
    {
        $id = $this->params()->fromRoute('id', $this->params()->fromQuery('id', ''));

        $melisKey = $this->params()->fromRoute('melisKey', '');
        $title    = $this->tool()->getTranslation('tr_melis_cms_prospects_theme_new_title');
        $data     = array();
        $form     = $this->getThemeForm();

        if(is_numeric($id)) {
            $title = $this->tool()->getTranslation('tr_melis_cms_prospects_theme_edit_title');
            $data  = (array) $this->themeTable()->getEntryById((int) $id)->current();
            $form->setData($data);
        }
        else {
            $form->get('pros_theme_id')->setAttribute('style', 'display:none')->setLabel('');
            $form->get('pros_theme_id')->setLabelAttributes(array('style' => 'display:none'));
        }

        $view = new ViewModel();

        $view->melisKey = $melisKey;
        $view->title    = $title;
        $view->form     = $form;

        return $view;
    }
185494
protected function actionForm()
	{
		$blockCenter = new XmlBlockCollection($this->_myWords->Value("FORM"), BlockPosition::Center);

		$breakLine = new XmlnukeBreakLine();

		$paragraph = new XmlParagraphCollection();
		$blockCenter->addXmlnukeObject($paragraph);

		$paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("FORMTEXT")));

		$form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("FORMEDIT"));
		$paragraph->addXmlnukeObject($form);

		$form->setJSValidate(true);
		$form->addXmlnukeObject(new XmlInputHidden("op", "2"));
		$form->addXmlnukeObject(new XmlInputLabelField("Caption", $this->_myWords->Value("VALUE")));

		$text = new XmlInputTextBox($this->_myWords->Value("FIELDREQUIRED"), "field1", "");
		$text->setRequired(true);
		$form->addXmlnukeObject($text);

		$text = new XmlInputDateTime("Date Picker", "date1", DATEFORMAT::DMY, false);
		$form->addXmlnukeObject($text);

		$text = new XmlInputDateTime("Date Picker", "date2", DATEFORMAT::YMD, true);
		$form->addXmlnukeObject($text);

		$text = new XmlInputTextBox($this->_myWords->Value("FIELDEMAIL"), "field2", "");
		$text->setRequired(true);
		$text->setDataType(INPUTTYPE::EMAIL);
		$form->addXmlnukeObject($text);

		$form->addXmlnukeObject(new XmlInputMemo($this->_myWords->Value("MEMO"), "field3", $this->_myWords->Value("VALUE")));
		$form->addXmlnukeObject(new XmlInputCheck($this->_myWords->Value("CHECKBOX"), "check1", $this->_myWords->Value("VALUE")));

		$inputCheck = new XmlInputCheck($this->_myWords->Value("CAPTIONREADONLY"), "check2", $this->_myWords->Value("VALUE"));
		$inputCheck->setChecked(true);
		$inputCheck->setReadOnly(true);
		$form->addXmlnukeObject($inputCheck);

		$inputTextBox = new XmlInputTextBox($this->_myWords->Value("INPUTREADONLY"), "field4", $this->_myWords->Value("VALUE"));
		$inputTextBox->setReadOnly(true);
		$form->addXmlnukeObject($inputTextBox);

		$buttons = new XmlInputButtons();
		$buttons->addSubmit($this->_myWords->Value("SUBMIT"), "bs");
		$buttons->addReset($this->_myWords->Value("RESET"), "br");
		$buttons->addButton($this->_myWords->Value("BUTTON"), "bt", "javascript:alert('ok')");
		$form->addXmlnukeObject($buttons);

		$this->_document->addXmlnukeObject($blockCenter);
	}