Adds the url field to the form
179194
private function AddUrlField()
    {
        $name = 'Url';
        $this->AddField(Input::Text($name, $this->page->GetUrl()));
        $this->SetRequired($name);
        $this->AddValidator($name, DatabaseCount::UniqueFieldAnd($this->page, $name, $this->SiteCondition()));
    }
25994
private function AddOptionalParamsField()
    {
        $name = 'OptionalParameters';
        $field = new Textarea($name, $this->OptionalParamsText());
        $this->AddField($field);
        $this->SetTransAttribute($name, 'placeholder');
    }
782403
public DialogPage addForm(Form form) {
		DialogPage page = createDialogPage(form);
		addPage(page);
		return page;
	}
311658
protected function InitForm()
    {
        $this->htmlWrap = $this->LoadElement();
        $name = 'Html';
        $this->AddRichTextField($name, $this->htmlWrap->GetHtml());
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
102587
protected void addSpecialFields() {

        String firstTab = m_form.getWidget().getDefaultGroup();
        if (m_handler.hasEditableName()) {
            // the root entry name can't be edited
            CmsBasicFormField urlNameField = createUrlNameField();
            m_form.addField(firstTab, urlNameField);
        }
    }
1038940
private function AddBaseUrlField()
    {
        $name = 'BaseUrl';
        $this->AddField(Input::Text($name, $this->site->GetBaseUrl()));
    }
1118858
private function AddMenuAccessField()
    {
        $name = 'MenuAccess';
        $value = $this->page->Exists() ? $this->page->GetMenuAccess() : (string)MenuAccess::Authorized();
        $select = new Select($name, $value);
        foreach (MenuAccess::AllowedValues() as $access)
        {
            $select->AddOption($access, Trans("Core.PageForm.$name.$access"));
        }
        $this->AddField($select);
        $this->SetRequired($name);
    }
962635
private function buildEditForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $label = $field->title;
            if (in_array($field->validation,
                    $this->starred) && $field->type != 'password' && $field->type != 'file' && $field->type != 'photo'
            ) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $label = $field->relationship_name . '_id';
            }
            if ($field->type == 'checkbox') {
                $field->default = '$' . $this->model . '->' . $label . ' == 1';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                'old(\'$LABEL$\')',
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                'old(\'$LABEL$\',$' . $this->resource . '->' . $label . ')',
                $label,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', "' . $field->value . '"' : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsEdit = $form;
    }
551169
private function AddConfirmUrlField()
    {
        $name = 'ConfirmUrl';
        $this->selectorConfirm = new PageUrlSelector($name, Trans($this->Label($name)), $this->register->GetConfirmUrl());
        $this->selectorConfirm->SetRequired($this->ErrorPrefix($name));
        $this->Elements()->AddElement($name, $this->selectorConfirm);
    }
204932
public static function url($input, $field_name = 'url')
    {
        //Define trivial model
        $model = [
            $field_name => ['type' => Validate::TYPE_URL, Validate::REQUIRED]
        ];

        $parameters = [$field_name => $input];
        Validate::model($parameters, $model);

        return $parameters[$field_name];
    }
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;
        }

    }
1361092
protected function add_hidden_fields() {
        $mform = $this->_form;

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $mform->addElement('hidden', 'inpopup');
        $mform->setType('inpopup', PARAM_INT);

        $mform->addElement('hidden', 'cmid');
        $mform->setType('cmid', PARAM_INT);

        $mform->addElement('hidden', 'courseid');
        $mform->setType('courseid', PARAM_INT);

        $mform->addElement('hidden', 'returnurl');
        $mform->setType('returnurl', PARAM_LOCALURL);

        $mform->addElement('hidden', 'scrollpos');
        $mform->setType('scrollpos', PARAM_INT);

        $mform->addElement('hidden', 'appendqnumstring');
        $mform->setType('appendqnumstring', PARAM_ALPHA);
    }
816316
protected function submitAddField()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('field');
        $this->addField();
    }
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;
	}
575353
def action_add_url(self):
        """"""
        if not self.env.context.get('active_model'):
            return
        attachment_obj = self.env['ir.attachment']
        for form in self:
            url = parse.urlparse(form.url)
            if not url.scheme:
                url = parse.urlparse('%s%s' % ('http://', form.url))
            for active_id in self.env.context.get('active_ids', []):
                attachment = {
                    'name': form.name,
                    'type': 'url',
                    'url': url.geturl(),
                    'res_id': active_id,
                    'res_model': self.env.context['active_model'],
                }
                attachment_obj.create(attachment)
        return {'type': 'ir.actions.act_close_wizard_and_reload_view'}
122868
protected function InitForm()
    {
        $this->logout = $this->LoadElement();
        $this->AddNextUrlField();
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
1062753
public function AddFolderForm() {
        $fields=new FieldList(
                            new TabSet('Root',
                                            new Tab('Main', 'Main',
                                                                    new TextField('Name', _t('SnippetFolder.NAME', '_Name'), null, 150)
                                                                )
                                        )
                        );
        
        
        $noParent=true;
        if(strpos($this->request->getVar('ParentID'), 'language-')!==false) {
            $fields->push(new HiddenField('LanguageID', 'LanguageID', intval(str_replace('language-', '', $this->request->getVar('ParentID')))));
            
            $noParent=false;
        }else if(strpos($this->request->getVar('ParentID'), 'folder-')!==false) {
            $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ParentID'))));
            
            if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                $fields->push(new HiddenField('ParentID', 'ParentID', $folder->ID));
                $fields->push(new HiddenField('LanguageID', 'LanguageID', $folder->LanguageID));
                
                $noParent=false;
            }
        }else {
            if($this->request->postVar('LanguageID')) {
                $fields->push(new HiddenField('LanguageID', 'LanguageID', intval($this->request->postVar('LanguageID'))));
                
                $noParent=false;
            }
               
            if($this->request->postVar('ParentID')) {
                $fields->push(new HiddenField('ParentID', 'ParentID', intval($this->request->postVar('ParentID'))));
                
                $noParent=false;
            }
        }
        
        
        $actions=new FieldList(
                                new FormAction('doAddFolder', _t('CodeBank.SAVE', '_Save'))
                            );
        
        $validator=new RequiredFields('Name');
        
        $form=new Form($this, 'AddFolderForm', $fields, $actions, $validator);
        $form->addExtraClass('member-profile-form');
        
        
        //If no parent disable folder
        if($noParent) {
            $form->setMessage(_t('CodeBank.FOLDER_NO_PARENT', '_Folder does not have a parent language or folder'), 'bad');
            $form->setFields(new FieldList());
            $form->setActions(new FieldList());
        }
        
        return $form;
    }