function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Name', 'Name'));
     $fields->add(new HtmlEditorField('Comment', 'Comment'));
     $fields->add(new HtmlEditorField('Guidance', 'Guidance'));
     $fields->add(new DropdownField('Status', 'Status', $this->dbObject('Status')->enumValues()));
     $fields->add($ddl_program = new CheckboxsetField('Program', 'Program', InteropProgramType::get()->filter('HasCapabilities', true)->sort('Order')->map("ID", "ShortName")));
     $fields->add($ddl_version = new CheckboxsetField('Version', 'Version', InteropProgramVersion::get()->map("ID", "Name")));
     if ($this->ID > 0) {
         $ddl_program->setValue('ID', $this->Program());
         $ddl_version->setValue('ID', $this->Version());
     }
     return $fields;
 }
 /**
  * A simple form for creating blog entries
  */
 function FrontEndPostForm()
 {
     if ($this->owner->request->latestParam('ID')) {
         $id = (int) $this->owner->request->latestParam('ID');
     } else {
         $id = 0;
     }
     $membername = Member::currentUser() ? Member::currentUser()->getName() : "";
     // Set image upload
     $uploadfield = UploadField::create('FeaturedImage', _t('BlogFrontEnd.ShareImage', "Share an image"));
     $uploadfield->setCanAttachExisting(false);
     $uploadfield->setCanPreviewFolder(false);
     $uploadfield->setAllowedFileCategories('image');
     $uploadfield->relationAutoSetting = false;
     if (BlogFrontEnd::config()->allow_wysiwyg_editing) {
         $content_field = TrumbowygHTMLEditorField::create("Content", _t("BlogFrontEnd.Content"));
     } else {
         $content_field = TextareaField::create("Content", _t("BlogFrontEnd.Content"));
     }
     $form = new Form($this->owner, 'FrontEndPostForm', $fields = new FieldList(HiddenField::create("ID", "ID"), TextField::create("Title", _t('BlogFrontEnd.Title', "Title")), $uploadfield, $content_field), $actions = new FieldList(FormAction::create('doSavePost', _t('BlogFrontEnd.PostEntry', 'Post Entry'))), new RequiredFields('Title'));
     $uploadfield->setForm($form);
     if ($this->owner->Categories()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.PostUnderCategories", "Post this in a category? (optional)"), $this->owner->Categories()->map()));
     }
     if ($this->owner->Tags()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.AddTags", "Add a tag? (optional)"), $this->owner->Tags()->map()));
     }
     if ($id && ($post = BlogPost::get()->byID($id))) {
         $form->loadDataFrom($post);
     }
     $this->owner->extend("updateFrontEndPostForm", $form);
     return $form;
 }
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Name', 'Name'));
     $fields->add(new HtmlEditorField('Description', 'Description'));
     $fields->add(new DropdownField('Status', 'Status', $this->dbObject('Status')->enumValues()));
     $fields->add($ddl_program = new CheckboxsetField('Program', 'Program', InteropProgramType::get()->filter('HasCapabilities', true)->sort('Order')->map("ID", "ShortName")));
     $fields->add($ddl_version = new CheckboxsetField('Version', 'Version', InteropProgramVersion::get()->map("ID", "Name")));
     $fields->add($ddl_type = new DropdownField('TypeID', 'Type', Dataobject::get("InteropCapabilityType")->map("ID", "Name", "Please Select")));
     if ($this->ID > 0) {
         $ddl_program->setValue('ID', $this->Program());
         $ddl_version->setValue('ID', $this->Version());
         $ddl_type->setValue($this->TypeID);
     }
     return $fields;
 }
 public function __construct($controller, $name, $discussion = null)
 {
     // Get member and upload path
     $member = Member::currentUser();
     $fields = new FieldList(HiddenField::create("ID"), TextField::create("Title", _t("Discussions.GiveTitle", "Give your discussion a title")), TextAreaField::create("Content", _t("Discussions.AddContent", "And some content (optional)")), TextField::create("Tags", _t("Discussions.AddTags", "Finally, add some tags (optional)"))->setAttribute("placeholder", "Tag 1, Tag 2"));
     if ($controller->Categories()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("Discussions.Categories", "Or Post this under a category? (optional)"), $controller->Categories()->map()));
     }
     $actions = new FieldList(FormAction::create("post")->setTitle(_t("Discussions.Post", "Post")));
     $validator = new RequiredFields("Title", "Content");
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function FoundationForm()
 {
     $fields = new FieldList(HeaderField::create('FormFieldsHeader', 'Form Fields', 3), TextField::create('TextField', 'TextField'), EmailField::create('EmailField', 'EmailField'), PasswordField::create('PasswordField', 'PasswordField'), TextareaField::create('TextareaField', 'TextareaField'), FileField::create('FileField', 'FileField'), CheckboxField::create('CheckboxField', 'CheckboxField'), DropdownField::create('DropdownField', 'DropdownField')->setSource(array('NZ' => 'New Zealand', 'US' => 'United States', 'GEM' => 'Germany'))->setEmptyString(''), CheckboxsetField::create('CheckboxsetField', 'CheckboxsetField')->setSource(array('NZ' => 'New Zealand', 'US' => 'United States', 'GEM' => 'Germany')), OptionsetField::create('OptionsetField', 'OptionsetField')->setSource(array('NZ' => 'New Zealand', 'US' => 'United States', 'GEM' => 'Germany')), HeaderField::create('FieldGroupHeader', 'Field Groups', 3), FieldGroup::create(TextField::create('FieldGroupTextField', 'TextField')->addExtraClass('small-6 columns'), TextField::create('FieldGroupTextField1', 'TextField')->addExtraClass('small-6 columns')), FieldGroup::create(TextField::create('FieldGroupTextField2', 'TextField')->addExtraClass('small-4 columns'), TextField::create('FieldGroupTextField3', 'TextField')->addExtraClass('small-4 columns'), TextField::create('FieldGroupTextField4', 'TextField')->addExtraClass('small-4 columns')), FieldGroup::create(TextField::create('FieldGroupTextField5', 'TextField')->addExtraClass('small-3 columns'), TextField::create('FieldGroupTextField6', 'TextField')->addExtraClass('small-3 columns'), TextField::create('FieldGroupTextField7', 'TextField')->addExtraClass('small-3 columns'), TextField::create('FieldGroupTextField8', 'TextField')->addExtraClass('small-3 columns')), FieldGroup::create(TextField::create('FieldGroupTextField9', 'TextField')->addExtraClass('large-2 small-4 columns'), TextField::create('FieldGroupTextField10', 'TextField')->addExtraClass('large-2 small-4 columns'), TextField::create('FieldGroupTextField11', 'TextField')->addExtraClass('large-2 small-4 columns'), TextField::create('FieldGroupTextField12', 'TextField')->addExtraClass('large-2 small-4 columns'), TextField::create('FieldGroupTextField13', 'TextField')->addExtraClass('large-2 small-4 columns'), TextField::create('FieldGroupTextField14', 'TextField')->addExtraClass('large-2 small-4 columns')), FieldGroup::create(TextField::create('FieldGroupTextField15', 'TextField')->addExtraClass('small-6 columns'), TextField::create('FieldGroupTextField16', 'TextField')->addExtraClass('small-4 columns'), TextField::create('FieldGroupTextField17', 'TextField')->addExtraClass('small-2 columns')), FieldGroup::create(DropdownField::create('DropdownField2', 'DropdownField')->setSource(array('NZ' => 'New Zealand', 'US' => 'United States', 'GEM' => 'Germany'))->addExtraClass('large-6 small-6 columns')->setEmptyString(''), DropdownField::create('DropdownField3', 'DropdownField')->setSource(array('NZ' => 'New Zealand', 'US' => 'United States', 'GEM' => 'Germany'))->addExtraClass('large-6 small-6 columns')->setEmptyString('')), HeaderField::create('SwitchFieldsHeader', 'Switch Fields', 3), FoundationSwitchField::create('SwitchField', 'SwitchField', array(0 => 'Off', 1 => 'On'))->addExtraClass('large-12'), FoundationSwitchField::create('SwitchField2', 'SwitchField', array(0 => 'Off', 1 => 'On'))->addExtraClass('large round'));
     $actions = new FieldList(new FormAction('submitFoundationForm', 'Submit'));
     // set all to required to see the validation message appearance
     $required = array();
     if ($dataFields = $fields->dataFields()) {
         foreach ($dataFields as $child) {
             $required[] = $child->getName();
         }
     }
     $validator = new RequiredFields($required);
     $form = new FoundationForm($this, __FUNCTION__, $fields, $actions, $validator);
     // load submitted data, and clear them from session
     if ($data = Session::get('FoundationForm' . $this->ID)) {
         $form->loadDataFrom($data);
         Session::clear('FoundationForm' . $this->ID);
     }
     return $form;
 }