function PopupForm()
 {
     $form = new Form($this, "{$this->name}/PopupForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', 'Edit Source'))), $codeField = new CodeEditorField('TinyMCESource', '')), new FieldList(ResetFormAction::create('cancel', 'Cancel')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true), FormAction::create('update', 'Update')->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     $headerWrap->addExtraClass('CompositeField composite cms-content-header nolabel ');
     //	$contentComposite->addExtraClass('tinymce-codeeditor-field content');
     $codeField->addExtraClass('nolabel stacked');
     $form->unsetValidator();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-codeform cms-dialog-content');
     //	$this->extend('updateLinkForm', $form);
     return $form;
 }
Beispiel #2
0
 /**
  * Return a {@link Form} instance allowing a user to
  * add links in the TinyMCE content editor.
  *  
  * @return Form
  */
 public function LinkForm()
 {
     $siteTree = new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'ID', 'MenuTitle', true);
     // mimic the SiteTree::getMenuTitle(), which is bypassed when the search is performed
     $siteTree->setSearchFunction(array($this, 'siteTreeSearchCallback'));
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
     $form = new Form($this->controller, "{$this->name}/LinkForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.LINK', 'Insert Link')))), $contentComposite = new CompositeField(new OptionsetField('LinkType', sprintf($numericLabelTmpl, '1', _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')), 'internal'), new LiteralField('Step2', '<div class="step2">' . sprintf($numericLabelTmpl, '2', _t('HtmlEditorField.DETAILS', 'Details')) . '</div>'), $siteTree, new TextField('external', _t('HtmlEditorField.URL', 'URL'), 'http://'), new EmailField('email', _t('HtmlEditorField.EMAIL', 'Email address')), new TreeDropdownField('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), new TextField('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')), new TextField('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')), new CheckboxField('TargetBlank', _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')), new HiddenField('Locale', null, $this->controller->Locale))), new FieldList(ResetFormAction::create('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true), FormAction::create('insert', _t('HtmlEditorField.BUTTONINSERTLINK', 'Insert link'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     $headerWrap->addExtraClass('CompositeField composite cms-content-header nolabel ');
     $contentComposite->addExtraClass('ss-insert-link content');
     $form->unsetValidator();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-linkform cms-dialog-content');
     $this->extend('updateLinkForm', $form);
     return $form;
 }
 function MyForm()
 {
     $form = Form::create($this, "MyForm", new FieldList(TextField::create("FirstName")->setTitle('First name')->setAttribute("placeholder", "Min. 3 znaky")->setAttribute("data-validation-required-message", "nezabudnite vpísať vaše meno")->setAttribute("required", true), TextField::create("Surname")->setTitle('Last name')->setMaxLength(50)->setAttribute("required", true), EmailField::create("Email")->setTitle("Email address")->setAttribute("required", true)->setAttribute("data-validation-email-message", "nezabudnite napísať existujúci majl")->setAttribute('type', 'email'), DropdownField::create("Cisla")->setTitle("Čísla")->setSource(array("jedna", "dva", "tri"))->addExtraClass("expand")->setEmptyString("musíš vybrať jedno numero"), CheckboxField::create("Donkey")->setTitle("Si donkey?"), CheckboxField::create("Donkey2")->setTitle("Si veľmi dlhý a vráskavý donkey s malými ušami?"), ReadonlyField::create("ReadOnly")->setTitle("Toto nezmeníte.... readonly")->setValue("nemeniteľné"), TextareaField::create("Text")->setTitle("Poznámka"), DateField::create("Dátum")->setConfig("showcalendar", true)->setConfig("jQueryUI.firstDay", 1)->setConfig("jQueryUI.dayNamesMin", array("Ne", "Po", "Ut", "St", "Št", "Pi", "So"))->setLocale('sk_SK'), DatetimeField::create('DátumČas', 'Dátum a čas')->setConfig('datavalueformat', 'yyyy-MM-dd HH:mm')->setConfig('showcalendar', 1), GroupedDropdownField::create("grouped")->setTitle("Zoskupený dropdown")->setSource(array("numbers" => array("1", "2", "3"), "letters" => array("a", "b", "c"))), OptionsetField::create("options")->setTitle("Čísla 2")->setSource(array("jedna", "dva", "tri")), HeaderField::create("header", "Toto je nadpis")->setTitle("overwritten nadpissss"), LiteralField::create("dataless", "html here")->setTitle("dataless")->setContent("<p>Or overwritten here</p><ul><li>item 1</li><li>item 2</li></ul>"), FileField::create("Nahraj")), new FieldList(FormAction::create("doMyForm")->setTitle("Odoslať")->addExtraClass("button radius"), ResetFormAction::create("resetMyForm", "Reset")->addExtraClass("button secondary small radius")), new RequiredFields("Email", "FirstName", "Text"))->setAttribute("novalidate", "novalidate")->addExtraClass("custom horizontal");
     return $form;
 }