function __construct($controller, $name, $speakerID, $use_actions = true) { $fields = new FieldList(); //point of contact $speakerIDfield = new HiddenField('speaker_id'); $speakerIDfield->setValue($speakerID); $fields->push($speakerIDfield); $fields->push(new TextField('org_name', 'Name of Organizer')); $fields->push(new EmailField('org_email', 'Email')); $fields->push(new TextField('event_name', 'Event')); $fields->push(new TextField('event_format', 'Format/Length')); $fields->push(new TextField('event_attendance', 'Expected Attendance (number)')); $fields->push(new TextField('event_date', 'Date of Event')); $fields->push(new TextField('event_location', 'Location')); $fields->push(new TextField('event_topic', 'Topic(s)')); $request = new HtmlEditorField('general_request', 'General Request'); $request->setRows(10); $fields->push($request); $sec_field = new TextField('field_98438688', 'field_98438688'); $sec_field->addExtraClass('honey'); $fields->push($sec_field); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('sendSpeakerEmail', 'Send')); } parent::__construct($controller, $name, $fields, $actions); }
/** * Setup the CMS Fields for the User Defined Form * * @return FieldSet */ public function getCMSFields() { $fields = parent::getCMSFields(); // define tabs $fields->findOrMakeTab('Root.Form', _t('UserDefinedForm.FORM', 'Form')); $fields->findOrMakeTab('Root.Options', _t('UserDefinedForm.OPTIONS', 'Options')); $fields->findOrMakeTab('Root.EmailRecipients', _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients')); $fields->findOrMakeTab('Root.OnComplete', _t('UserDefinedForm.ONCOMPLETE', 'On Complete')); $fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions')); // field editor $fields->addFieldToTab("Root.Form", new FieldEditor("Fields", 'Fields', "", $this)); // view the submissions $fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', "Disable Saving Submissions to Server"))); $fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField("Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this)); UserDefinedForm_EmailRecipient::$summary_fields = array('EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')); // who do we email on submission $emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10)); $fields->addFieldToTab("Root.EmailRecipients", $emailRecipients); // text to show on complete $onCompleteFieldSet = new FieldList($editor = new HtmlEditorField("OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage))); $editor->setRows(3); $fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet); $fields->addFieldsToTab("Root.Options", $this->getFormOptions()); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('PageBuilder'); /* ========================================= * Images =========================================*/ $fields->addFieldToTab('Root.Main', new UploadField('Image'), 'Content'); /* ========================================= * Menu Item Details =========================================*/ $fields->addFieldToTab('Root.Main', $price = new CurrencyField('Price'), 'Content'); $price->setRightTitle('To add extra price options e.g Small, Large please add a variation under the "Variations" tab above'); $fields->addFieldToTab('Root.Main', $ingredients = new HtmlEditorField('Ingredients'), 'Metadata'); $ingredients->setRows(15); /* ========================================= * Variations =========================================*/ $config = GridFieldConfig_RelationEditor::create(10); $config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction()); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'Price' => 'Price')); $gridField = new GridField('Variations', 'Variations', $this->owner->MenuVariations(), $config); $fields->addFieldToTab('Root.Variations', $gridField); return $fields; }
public function getCMSFields() { $oFieldExternalLink = new TextField('LinkExternalUrl', 'Externe link (opent in nieuw venster, begin met http://)', $this->LinkExternalUrl); $name = $oFieldExternalLink->getName(); $name = preg_replace("/([A-Za-z0-9\\-_]+)/", "Widget[" . $this->ID . "][\\1]", $name); $oFieldExternalLink->setName($name); $oFieldInternalLink = new SimpleTreeDropdownField('InternalUrlID', 'Interne link', 'SiteTree', $this->InternalUrlID, null, 'Kies een pagina'); $name = $oFieldInternalLink->getName(); $name = preg_replace("/([A-Za-z0-9\\-_]+)/", "Widget[" . $this->ID . "][\\1]", $name); $oFieldInternalLink->setName($name); $aSelectionGroupItems = array(new SelectionGroup_Item('none', new LiteralField('nolink', ''), 'Geen link'), new SelectionGroup_Item('internal', $oFieldInternalLink, 'Interne link'), new SelectionGroup_Item('external', $oFieldExternalLink, 'Externe link')); $fldSelectionGroup = new SelectionGroup('LinkType', $aSelectionGroupItems); // config htmleditor // make a new TinyMCE config called "footer" by copying the default ("cms") config /* $footerConfig = CustomHtmlEditorConfig::copy('simpletoolbar', 'cms'); $footerConfig->setButtonsForLine(3, array()); $footerConfig->setButtonsForLine(2, array()); */ $oFields = new FieldList(new TextField('Header', 'Titel'), $fldBody = new HtmlEditorField('Body', 'Inhoud'), new HeaderField('hdrLink', 'Link', 3), new TextField('LinkTxt', 'Tekst link'), $fldSelectionGroup); $fldBody->setRows(6); // assign the "footer" TinyMCE config to this field $fldBody->setEditorConfig('simpletoolbar'); // set the editor's body class. This will make it class="typography footer-content" $fldBody->setBodyClass('widget_text typograhy'); return $oFields; }
public function updateCMSFields(FieldList $fields) { /* ----------------------------------------- * Color Picker ------------------------------------------*/ Requirements::css('boilerplate/css/colorpicker.css'); Requirements::javascript('boilerplate/javascript/colorpicker.min.js'); Requirements::javascript('boilerplate/javascript/colorpicker.init.js'); /* ========================================= * Settings =========================================*/ if (!$fields->fieldByName('Root.Settings')) { $fields->addFieldToTab('Root', new TabSet('Settings')); } /* ----------------------------------------- * Images ------------------------------------------*/ $fields->findOrMakeTab('Root.Settings.Images', 'Images'); $fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon')))); $logo->setRightTitle('Choose an Image For Your Logo'); $favicon->setRightTitle('Choose an Image For Your Favicon (16x16)'); /* ----------------------------------------- * Company Details ------------------------------------------*/ $fields->findOrMakeTab('Root.Settings.Details', 'Details'); $fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address')))); $PhysicalAddress->setRows(3); /* ----------------------------------------- * Tracking Code ------------------------------------------*/ $fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code'); $fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code')))); $trackingCode->setRows(20); }
function getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldToTab('Root.Main', new UploadField('Image')); $fields->addFieldToTab('Root.Main', $caption = new HtmlEditorField('Caption')); $caption->setRows(15); return $fields; }
function updateCMSFields(FieldList $fields) { $fields->addFieldToTab('Root.Resourses', $he = new HtmlEditorField("ResoursesContent", "Content")); $he->setRows(7); $options = $this->owner->Resourses(); $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(10), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldSortableRows('SortOrder')); $itemsTable = new GridField("Resourses", "Resourses", $options, $gridFieldConfig); $fields->addFieldToTab('Root.Resourses', $itemsTable); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->insertAfter($submitted = new HtmlEditorField('AfterSubmissionContent'), 'Content'); $submitted->setRows(20); $submitted->setRightTitle('Displayed after a user submits a game for approval'); $fields->insertAfter($loggedOut = new HtmlEditorField('LoggedOutMessage'), 'Content'); $loggedOut->setRows(20); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Name'); $fields->removeByName('OwnerID'); $fields->removeByName('ParentID'); $fields->addFieldToTab('Root.Main', $caption = new HtmlEditorField('Caption')); $caption->setRows(5); $fields->addFieldToTab('Root.Main', new TextField('SortOrder')); return $fields; }
function updateCMSFields(FieldList $fields) { if ($this->canHaveMap()) { $reloadMessage = " "; if (!$this->owner->ShowMap) { $reloadMessage = " (save (and publish) to see additional options)"; } $fields->addFieldToTab("Root.Map", new CheckboxField("ShowMap", "Show map {$reloadMessage}")); if ($this->owner->ShowMap) { $fields->addFieldToTab("Root.Map", new CheckboxField("StaticMap", "Show map as picture only")); $fields->addFieldToTab("Root.Map", new TextField("Address")); $fields->addFieldToTab("Root.Map", new NumericField("ZoomLevel", "Zoom (1 = world, 20 = too close)")); $fields->addFieldToTab("Root.Map", $htmlEditorField = new HtmlEditorField("InfoWindowContent", "Info Window Content")); $htmlEditorField->setRows(5); } } }
function getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); /* ----------------------------------------- * Color Picker ------------------------------------------*/ Requirements::css('boilerplate/css/colorpicker.css'); Requirements::javascript('boilerplate/javascript/colorpicker.min.js'); Requirements::javascript('boilerplate/javascript/colorpicker.init.js'); $fields->addFieldToTab('Root.Main', new TabSet($name = "WidgetTabs", new Tab($title = 'Page Item', new HeaderField(_t('PageItem.PageItemTabText', 'Title')), $titleField = new TextField('Title', _t('PageItem.TitleLabel', 'Page Item Title')), new HtmlEditorField('Content', _t('PageItem.ContentLabel', 'Content'))), new Tab($title = 'Columns', new HeaderField(_t('PageItem.ColumnsTabText', 'Columns')), $columnType = new DropdownField('ColumnType', 'Column Type', array(0 => 'Default', 1 => '1/3, 2/3', 2 => '2/3, 1/3')), $columnOne = new HtmlEditorField('ColumnOne', _t('PageItem.ColumnOneLabel', 'Column One')), $columnTwo = new HtmlEditorField('ColumnTwo', _t('PageItem.ColumnTwoLabel', 'Column Two')), $columnThree = new HtmlEditorField('ColumnThree', _t('PageItem.ColumnThreeLabel', 'Column Three')), $columnFour = new HtmlEditorField('ColumnFour', _t('PageItem.ColumnFourLabel', 'Column Four'))), new Tab($title = 'Settings', new HeaderField(_t('PageItem.SettingsTabText', 'Settings (Optional)')), new CheckboxField('Padding', _t('PageItem.PaddingLabel', 'Remove Padding')), new UploadField('BackgroundImage', _t('PageItem.BackgroundImageLabel', 'Background Image')), new DropdownField('BackgroundType', _t('PageItem.BackgroundTypeLabel', 'Background Type'), array('' => 'Default', 'fixed' => 'Fixed')), new ColorField('BackgroundColor', _t('PageItem.BackgroundColorLabel', 'Background Color'))))); $rowHeight = 20; $titleField->setRightTitle(_t('PageItem.WidgetTitleDescriptionText', 'Name your page item to be easily recognisable in the page item list e.g "Pricing columns"')); $columnOne->setRows($rowHeight); $columnTwo->setRows($rowHeight); $columnThree->setRows($rowHeight); $columnFour->setRows($rowHeight); return $fields; }
public function updateCMSFields(FieldList $fields) { $themes = MandrillEmail::getAvailableThemes(); $fields->addFieldToTab('Root.Email', $html = new HtmlEditorField('EmailFooter', _t('MandrillSiteConfig.EmailFooter', 'Email Footer'))); $html->setRows(5); $fields->addFieldToTab('Root.Email', $emailTheme = new DropdownField('EmailTheme', _t('MandrillSiteConfig.EmailTheme', 'Email Theme'), array_combine($themes, $themes))); $emailTheme->setEmptyString(''); $fields->addFieldToTab('Root.Email', new TextField('DefaultFromEmail', _t('MandrillSiteConfig.DefaultFromEmail', 'Default From Email'))); $fields->addFieldToTab('Root.Email', new TextField('DefaultToEmail', _t('MandrillSiteConfig.DefaultToEmail', 'Default To Email'))); // form-extras integration $uploadClass = 'UploadField'; if (class_exists('ImageUploadField')) { $uploadClass = 'ImageUploadField'; } $fields->addFieldToTab('Root.Email', $emailLogo = new $uploadClass('EmailLogo', _t('MandrillSiteConfig.EmailLogo', 'Email Logo'))); $emailLogo->setDescription(_t('MandrillSiteConfig.EmailLogoDesc', 'Will default to Logo if none defined')); return $fields; }
function getCMSFields() { $fields = new FieldList(); $fields->push(new TextField('Title', 'Title')); $fields->push($description = new HtmlEditorField('Description')); $description->setRows(5); $fields->push(new TextField('ButtonLink', 'Button Link')); $fields->push(new TextField('ButtonLabel', 'Button Label')); $fields->push(new TextField('SortOrder', 'Sort Order')); $image = new CustomUploadField('Image', 'Image'); $image->setFolderName('marketing'); $image->setAllowedFileCategories('image'); $image_validator = new Upload_Validator(); $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $image->setValidator($image_validator); $fields->push($image); $fields->push(new HiddenField('ParentPageID', 'ParentPageID')); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->insertBefore(new Tab('About'), 'Settings'); $fields->insertBefore(new Tab('Host'), 'Settings'); // header $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', $uploadField = new UploadField('HeaderPics', 'Header Pictures')); $uploadField->setAllowedMaxFileNumber(10); $uploadField->setFolderName('openstackdays'); // About $fields->addFieldToTab('Root.About', $about_desc = new HtmlEditorField('AboutDescription', 'Intro Text', $this->AboutDescription)); $config = new GridFieldConfig_RecordEditor(10); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('YoutubeID' => 'YoutubeID', 'Caption' => 'Caption', 'Active' => 'Active')); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.About', new GridField('AboutVideos', 'Videos', $this->AboutVideos(), $config)); // Host $fields->addFieldToTab('Root.Host', $host_intro = new HtmlEditorField('HostIntro', 'Intro Text', $this->HostIntro)); $fields->addFieldToTab('Root.Host', $host_faq = new HtmlEditorField('HostFAQs', 'FAQs', $this->HostFAQs)); $fields->addFieldToTab('Root.Host', $toolkit_text = new HtmlEditorField('ToolkitDesc', 'Toolkit Text', $this->ToolkitDesc)); $config = new GridFieldConfig_RecordEditor(3); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.Host', new GridField('OfficialGuidelines', 'Official Guidelines', $this->OfficialGuidelines(), $config)); $config = new GridFieldConfig_RecordEditor(3); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.Host', new GridField('PlanningTools', 'Planning Tools', $this->PlanningTools(), $config)); $fields->addFieldToTab('Root.Host', $artwork_intro = new HtmlEditorField('ArtworkIntro', 'Artwork intro text', $this->ArtworkIntro)); $artwork_intro->setRows(4); $config = new GridFieldConfig_RecordEditor(3); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.Host', new GridField('Artwork', 'Artwork', $this->Artwork(), $config)); $fields->addFieldToTab('Root.Host', $collateral_intro = new HtmlEditorField('CollateralIntro', 'Collateral intro text', $this->CollateralIntro)); $collateral_intro->setRows(4); $config = new GridFieldConfig_RecordEditor(10); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('YoutubeID' => 'YoutubeID', 'Caption' => 'Caption', 'Active' => 'Active')); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.Host', new GridField('Collaterals', 'Video / Presentations / Collateral', $this->Collaterals(), $config)); $config = new GridFieldConfig_RecordEditor(3); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->addFieldToTab('Root.Host', new GridField('Media', 'PR / Media', $this->Media(), $config)); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root', new TabSet('Profile', _t('MemberProfiles.PROFILE', 'Profile'))); $fields->addFieldToTab('Root', new Tab('ContentBlocks', _t('MemberProfiles.CONTENTBLOCKS', 'Content Blocks'))); $fields->addFieldToTab('Root', new Tab('Email', _t('MemberProfiles.Email', 'Email'))); $fields->fieldByName('Root.Main')->setTitle(_t('MemberProfiles.MAIN', 'Main')); $fields->addFieldsToTab('Root.Profile', array(new Tab('Fields', _t('MemberProfiles.FIELDS', 'Fields'), new GridField('Fields', _t('MemberProfiles.PROFILEFIELDS', 'Profile Fields'), $this->Fields(), $grid = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldAddNewButton'))), new Tab('Groups', _t('MemberProfiles.GROUPS', 'Groups'), $groups = new TreeMultiselectField('Groups', _t('MemberProfiles.GROUPS', 'Groups'), 'Group'), $selectable = new TreeMultiselectField('SelectableGroups', _t('MemberProfiles.SELECTABLEGROUPS', 'Selectable Groups'), 'Group')), new Tab('PublicProfile', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile'), new GridField('Sections', _t('MemberProfiles.PROFILESECTIONS', 'Profile Sections'), $this->Sections(), GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldAddNewButton')->addComponent(new MemberProfilesAddSectionAction()))))); $grid->getComponentByType('GridFieldDataColumns')->setFieldFormatting(array('Unique' => function ($val, $obj) { return $obj->dbObject('Unique')->Nice(); }, 'Required' => function ($val, $obj) { return $obj->dbObject('Required')->Nice(); })); if (class_exists('GridFieldOrderableRows')) { $grid->addComponent(new GridFieldOrderableRows('Sort')); } elseif (class_exists('GridFieldSortableRows')) { $grid->addComponent(new GridFieldSortableRows('Sort')); } if (!$this->AllowProfileViewing) { $disabledNote = new LiteralField('PublisProfileDisabledNote', sprintf('<p class="message notice">%s</p>', _t('MemberProfiles.PUBLICPROFILEDISABLED', 'Public profiles are currently disabled, you can enable them ' . 'in the "Settings" tab.'))); $fields->insertBefore($disabledNote, 'Sections'); } $groups->setDescription(_t('MemberProfiles.GROUPSNOTE', 'Any users registering via this page will always be added to ' . 'these groups (if registration is enabled). Conversely, a member ' . 'must belong to these groups in order to edit their profile on ' . 'this page.')); $selectable->setDescription(_t('MemberProfiles.SELECTABLENOTE', 'Users can choose to belong to these groups, if the "Groups" field ' . 'is enabled in the "Fields" tab.')); $fields->removeByName('Content', true); $contentFields = array(); if ($this->AllowRegistration) { $contentFields[] = 'Registration'; $contentFields[] = 'AfterRegistration'; } if ($this->AllowProfileEditing) { $contentFields[] = 'Profile'; } foreach ($contentFields as $type) { $fields->addFieldToTab("Root.ContentBlocks", new ToggleCompositeField("{$type}Toggle", _t('MemberProfiles.' . strtoupper($type), FormField::name_to_label($type)), array(new TextField("{$type}Title", _t('MemberProfiles.TITLE', 'Title')), $content = new HtmlEditorField("{$type}Content", _t('MemberProfiles.CONTENT', 'Content'))))); $content->setRows(15); } $fields->addFieldsToTab('Root.Email', array(new OptionsetField('EmailType', _t('MemberProfiles.EMAILSETTINGS', 'Email Settings'), array('Validation' => _t('MemberProfiles.EMAILVALIDATION', 'Require email validation'), 'Confirmation' => _t('MemberProfiles.EMAILCONFIRMATION', 'Send a confirmation email'), 'None' => _t('MemberProfiles.NONE', 'None'))), new ToggleCompositeField('EmailContentToggle', _t('MemberProfiles.EMAILCONTENT', 'Email Content'), array(new TextField('EmailSubject', _t('MemberProfiles.EMAILSUBJECT', 'Email subject')), new TextField('EmailFrom', _t('MemberProfiles.EMAILFROM', 'Email from')), new TextareaField('EmailTemplate', _t('MemberProfiles.EMAILTEMPLATE', 'Email template')), new LiteralField('TemplateNote', sprintf('<div class="field">%s</div>', MemberConfirmationEmail::TEMPLATE_NOTE)))), new ToggleCompositeField('ConfirmationContentToggle', _t('MemberProfiles.CONFIRMCONTENT', 'Confirmation Content'), array(new TextField('ConfirmationTitle', _t('MemberProfiles.TITLE', 'Title')), $confContent = new HtmlEditorField('ConfirmationContent', _t('MemberProfiles.CONTENT', 'Content')))))); $confContent->setRows(15); return $fields; }
function __construct($controller, $name, $use_actions = true) { $RatingField = new TextField('rating', ''); $RatingField->setValue(0); $TitleField = new TextField('title', 'Title'); $CommentField = new HtmlEditorField('comment', 'Comment'); $CommentField->setRows(8); $CompanyServiceIDField = new HiddenField('company_service_ID', ''); $CompanyServiceIDField->setValue($controller->company_service_ID); $LoggedInField = new HiddenField('logged_in', ''); if (Member::CurrentUser()) { $LoggedInField->setValue(1); } $fields = new FieldList($RatingField, $TitleField, $CommentField, $CompanyServiceIDField, $LoggedInField); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('saveReview', 'Submit')); } $this->addExtraClass('review-form'); parent::__construct($controller, $name, $fields, $actions); }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', $header = new HtmlEditorField('Header', 'Header')); $header->setRows(5); $fields->addFieldToTab('Root.Main', $summary = new HtmlEditorField('Summary', 'Summary')); $summary->setRows(5); $fields->addFieldToTab('Root.Main', $whychange = new HtmlEditorField('WhyTheChange', 'Why The Change')); $whychange->setRows(5); $fields->addFieldToTab('Root.Main', $graph = new UploadField('Graph', 'Graph')); $fields->addFieldToTab('Root.Main', $hotel = new HtmlEditorField('HotelAndTravel', 'Hotel & Travel')); $hotel->setRows(5); $fields->addFieldToTab('Root.Main', new TextField('HotelLink', 'Hotel Link')); $fields->addFieldToTab('Root.Main', $attend = new HtmlEditorField('WhoShouldAttend', 'Who Should Attend')); $attend->setRows(5); $fields->addFieldToTab('Root.Main', $notattend = new HtmlEditorField('WhoShouldNotAttend', 'Who Should Not Attend')); $notattend->setRows(5); $fields->addFieldToTab('Root.Main', $benefit = new HtmlEditorField('Benefits', 'How can this benefit?')); $benefit->setRows(5); $fields->addFieldToTab('Root.Main', $sponsor = new HtmlEditorField('Sponsor', 'What are PTG Events & Why Sponsor?')); $sponsor->setRows(5); $fields->addFieldToTab('Root.Main', $sponsor_steps = new HtmlEditorField('SponsorSteps', 'Steps to Sponsoring the PTG event')); $sponsor_steps->setRows(5); $fields->addFieldToTab('Root.Main', $travel_sup = new HtmlEditorField('TravelSupport', 'Travel Support Program')); $travel_sup->setRows(5); $fields->addFieldToTab('Root.Main', $travel_sup_app = new HtmlEditorField('TravelSupportApply', 'Apply for Travel Support')); $travel_sup_app->setRows(5); $fields->addFieldToTab('Root.Main', $register = new HtmlEditorField('RegisterToAttend', 'Register to Attend')); $register->setRows(5); $fields->addFieldToTab('Root.Main', $schedule = new HtmlEditorField('PTGSchedule', 'PTG Schedule')); $schedule->setRows(5); $fields->addFieldToTab('Root.Main', $schedule_image = new UploadField('ScheduleImage', 'Schedule')); $fields->addFieldToTab('Root.Main', $coc = new HtmlEditorField('CodeOfConduct', 'Code of Conduct')); $coc->setRows(5); $fields->addFieldToTab('Root.Main', $findout = new HtmlEditorField('FindOutMore', 'Find Out More')); $findout->setRows(5); return $fields; }
function __construct($controller, $name, $use_actions = true) { $RatingField = new TextField('rating', ''); $RatingField->setValue(0); $CommentField = new HtmlEditorField('comment', 'Comment'); $CommentField->setRows(8); $sec_field = new TextField('field_98438688', 'field_98438688'); $sec_field->addExtraClass('honey'); $fields = new FieldList($RatingField, $CommentField, $sec_field); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('submit', 'Submit')); } $this->addExtraClass('review-form'); $css = <<<CSS .honey { \tposition: absolute; left: -9999px } CSS; Requirements::customCSS($css, 'honey_css'); parent::__construct($controller, $name, $fields, $actions); }
function getCMSFields() { $fields = new FieldList(); $fields->push(new TextField('Name', 'Name')); $fields->push($description = new HtmlEditorField('Description')); $description->setRows(5); $fields->push(new TextField('ReleaseLink', 'Release Link')); $fields->push(new TextField('SortOrder', 'Sort Order')); $fields->push(new TextField('YoutubeID', 'YouTube ID for video Link')); //$fields->merge($this->Video()->getCMSFields()); $image = new CustomUploadField('Logo', 'Logo'); $image->setFolderName('marketing'); $image->setAllowedFileCategories('image'); $image_validator = new Upload_Validator(); $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $image->setValidator($image_validator); $fields->push($image); $presentation = new UploadField('Presentation', 'Presentation'); $presentation->setFolderName('marketing'); $fields->push($presentation); $fields->push(new HiddenField('ParentPageID', 'ParentPageID')); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); // Add a box to customise the blurb $blurbField = new HtmlEditorField('Blurb', 'Blurb'); $blurbField->setRows(2); $fields->addFieldToTab('Root.Main', $blurbField, 'Content'); // Setup the contact form settings $fields->addFieldToTab('Root.ContactForm', new TextField('MailTo', 'Email enquiries to')); $fields->addFieldToTab('Root.ContactForm', new TextField('MailFrom', 'Email enquiries from')); $fields->addFieldToTab('Root.ContactForm', new TextareaField('SubmitText', 'Message when email submitted')); // Create a default configuration for the new GridField, allowing record deletion $config = GridFieldConfig_RecordEditor::create(); $config->removeComponentsByType('GridFieldAddNewButton'); $config->removeComponentsByType('GridFieldEditButton'); // Set the names and data for our gridfield columns $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name', 'Email' => 'Email', 'Message' => 'Message')); // Create a gridfield to hold the submission relationship $contactFormEnquiriesGridField = new GridField('ContactFormSubmissions', 'Contact Form Enquiries', $this->ContactFormSubmissions(), $config); // Create a tab named "Enquiries" and add our field to it $fields->addFieldToTab('Root.Enquiries', $contactFormEnquiriesGridField); return $fields; }
function getCMSFields() { $fields = new FieldList(); $fields->push(new TextField('Name', 'Name')); $fields->push(new CheckboxField('ShowGlobe', 'Show Globe')); $fields->push($description = new HtmlEditorField('Description')); $description->setRows(5); $fields->push(new TextField('SortOrder', 'Sort Order')); $image = new CustomUploadField('Image', 'Image'); $image->setFolderName('marketing'); $image->setAllowedFileCategories('image'); $image_validator = new Upload_Validator(); $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $image->setValidator($image_validator); $fields->push($image); $files = new UploadField('CollateralFiles', 'Files', $this->CollateralFiles()); $files->setFolderName('marketing'); $fields->push($files); $config = new GridFieldConfig_RecordEditor(3); $config->addComponent(new GridFieldSortableRows('SortOrder')); $fields->push(new GridField('CollateralLinks', 'CollateralLinks', $this->CollateralLinks(), $config)); $fields->push(new HiddenField('ParentPageID', 'ParentPageID')); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $group = new FieldGroup(); $group->setTitle(_t('News.Author')); $group->setDescription(_t('News.AuthorPage')); $fields->addFieldToTab('Root.Main', $group, 'Metadata'); $field = new TextField('AuthorName', _t('News.Name')); $group->push($field); $field = new TextField('AuthorURI', _t('News.URI')); $group->push($field); $field = new TextField('AuthorEmail', _t('News.Email')); $group->push($field); $field = new DateField('Published', _t('News.Published')); $field->setDescription(_t('News.PublishedDescription')); $field->setLocale($this->config()->date_locale); $field->setConfig('dateformat', $this->config()->date_format); $field->setConfig('showcalendar', true); $fields->addFieldToTab('Root.Main', $field, 'Content'); $field = new HtmlEditorField('Summary', _t('News.Summary')); $field->setRows(4); $fields->addFieldToTab('Root.Main', $field, 'Content'); return $fields; }
/** * @return FieldList */ public function getCMSFields() { $self = $this; $this->beforeUpdateCMSFields(function ($fields) use($self) { // define tabs $fields->findOrMakeTab('Root.FormContent', _t('UserDefinedForm.FORM', 'Form')); $fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration')); $fields->findOrMakeTab('Root.Recipients', _t('UserDefinedForm.RECIPIENTS', 'Recipients')); $fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions')); // field editor $fields->addFieldToTab('Root.FormContent', new FieldEditor('Fields', 'Fields', '', $self)); // text to show on complete $onCompleteFieldSet = new CompositeField($label = new LabelField('OnCompleteMessageLabel', _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion')), $editor = new HtmlEditorField('OnCompleteMessage', '', _t('UserDefinedForm.ONCOMPLETEMESSAGE', $self->OnCompleteMessage))); $onCompleteFieldSet->addExtraClass('field'); $editor->setRows(3); $label->addExtraClass('left'); // Define config for email recipients $emailRecipientsConfig = GridFieldConfig_RecordEditor::create(10); $emailRecipientsConfig->getComponentByType('GridFieldAddNewButton')->setButtonName(_t('UserDefinedForm.ADDEMAILRECIPIENT', 'Add Email Recipient')); // who do we email on submission $emailRecipients = new GridField('EmailRecipients', _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $self->EmailRecipients(), $emailRecipientsConfig); $emailRecipients->getConfig()->getComponentByType('GridFieldDetailForm')->setItemRequestClass('UserDefinedForm_EmailRecipient_ItemRequest'); $fields->addFieldsToTab('Root.FormOptions', $onCompleteFieldSet); $fields->addFieldToTab('Root.Recipients', $emailRecipients); $fields->addFieldsToTab('Root.FormOptions', $self->getFormOptions()); // view the submissions $submissions = new GridField('Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions'), $self->Submissions()->sort('Created', 'DESC')); // make sure a numeric not a empty string is checked against this int column for SQL server $parentID = !empty($self->ID) ? $self->ID : 0; // get a list of all field names and values used for print and export CSV views of the GridField below. $columnSQL = <<<SQL SELECT "Name", "Title" FROM "SubmittedFormField" LEFT JOIN "SubmittedForm" ON "SubmittedForm"."ID" = "SubmittedFormField"."ParentID" WHERE "SubmittedForm"."ParentID" = '{$parentID}' ORDER BY "Title" ASC SQL; $columns = DB::query($columnSQL)->map(); $config = new GridFieldConfig(); $config->addComponent(new GridFieldToolbarHeader()); $config->addComponent($sort = new GridFieldSortableHeader()); $config->addComponent($filter = new UserFormsGridFieldFilterHeader()); $config->addComponent(new GridFieldDataColumns()); $config->addComponent(new GridFieldEditButton()); $config->addComponent(new GridState_Component()); $config->addComponent(new GridFieldDeleteAction()); $config->addComponent(new GridFieldPageCount('toolbar-header-right')); $config->addComponent($pagination = new GridFieldPaginator(25)); $config->addComponent(new GridFieldDetailForm()); $config->addComponent($export = new GridFieldExportButton()); $config->addComponent($print = new GridFieldPrintButton()); /** * Support for {@link https://github.com/colymba/GridFieldBulkEditingTools} */ if (class_exists('GridFieldBulkManager')) { $config->addComponent(new GridFieldBulkManager()); } $sort->setThrowExceptionOnBadDataType(false); $filter->setThrowExceptionOnBadDataType(false); $pagination->setThrowExceptionOnBadDataType(false); // attach every column to the print view form $columns['Created'] = 'Created'; $filter->setColumns($columns); // print configuration $print->setPrintHasHeader(true); $print->setPrintColumns($columns); // export configuration $export->setCsvHasHeader(true); $export->setExportColumns($columns); $submissions->setConfig($config); $fields->addFieldToTab('Root.Submissions', $submissions); $fields->addFieldToTab('Root.FormOptions', new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server'))); }); $fields = parent::getCMSFields(); return $fields; }
/** * @return FieldList */ public function getCMSFields() { // call updateCMSFields after userforms SiteTree::disableCMSFieldsExtensions(); $fields = parent::getCMSFields(); SiteTree::enableCMSFieldsExtensions(); // define tabs $fields->findOrMakeTab('Root.FormContent', _t('UserDefinedForm.FORM', 'Form')); $fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration')); $fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions')); // field editor $fields->addFieldToTab("Root.FormContent", new FieldEditor("Fields", 'Fields', "", $this)); // text to show on complete $onCompleteFieldSet = new CompositeField($label = new LabelField('OnCompleteMessageLabel', _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion')), $editor = new HtmlEditorField("OnCompleteMessage", "", _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage))); $onCompleteFieldSet->addExtraClass('field'); $editor->setRows(3); $label->addExtraClass('left'); // Set the summary fields of UserDefinedForm_EmailRecipient dynamically via config system Config::inst()->update('UserDefinedForm_EmailRecipient', 'summary_fields', array('EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From'))); // who do we email on submission $emailRecipients = new GridField("EmailRecipients", _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10)); $emailRecipients->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName(_t('UserDefinedForm.ADDEMAILRECIPIENT', 'Add Email Recipient')); $fields->addFieldsToTab("Root.FormOptions", $onCompleteFieldSet); $fields->addFieldToTab("Root.FormOptions", $emailRecipients); $fields->addFieldsToTab("Root.FormOptions", $this->getFormOptions()); // view the submissions $submissions = new GridField("Reports", _t('UserDefinedForm.SUBMISSIONS', 'Submissions'), $this->Submissions()->sort('Created', 'DESC')); // make sure a numeric not a empty string is checked against this int column for SQL server $parentID = !empty($this->ID) ? $this->ID : 0; // get a list of all field names and values used for print and export CSV views of the GridField below. $columnSQL = <<<SQL SELECT "Name", "Title" FROM "SubmittedFormField" LEFT JOIN "SubmittedForm" ON "SubmittedForm"."ID" = "SubmittedFormField"."ParentID" WHERE "SubmittedForm"."ParentID" = '{$parentID}' ORDER BY "Title" ASC SQL; $columns = DB::query($columnSQL)->map(); $config = new GridFieldConfig(); $config->addComponent(new GridFieldToolbarHeader()); $config->addComponent($sort = new GridFieldSortableHeader()); $config->addComponent($filter = new UserFormsGridFieldFilterHeader()); $config->addComponent(new GridFieldDataColumns()); $config->addComponent(new GridFieldEditButton()); $config->addComponent(new GridState_Component()); $config->addComponent(new GridFieldDeleteAction()); $config->addComponent(new GridFieldPageCount('toolbar-header-right')); $config->addComponent($pagination = new GridFieldPaginator(25)); $config->addComponent(new GridFieldDetailForm()); $config->addComponent($export = new GridFieldExportButton()); $config->addComponent($print = new GridFieldPrintButton()); $sort->setThrowExceptionOnBadDataType(false); $filter->setThrowExceptionOnBadDataType(false); $pagination->setThrowExceptionOnBadDataType(false); // attach every column to the print view form $columns['Created'] = 'Created'; $filter->setColumns($columns); // print configuration $print->setPrintHasHeader(true); $print->setPrintColumns($columns); // export configuration $export->setCsvHasHeader(true); $export->setExportColumns($columns); $submissions->setConfig($config); $fields->addFieldToTab("Root.Submissions", $submissions); $fields->addFieldToTab("Root.FormOptions", new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', "Disable Saving Submissions to Server"))); $this->extend('updateCMSFields', $fields); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', new LiteralField('HideSections', '<label>Hide Sections</label><hr>')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideFee', 'Hide Exam Fee and Pricing')); $fields->addFieldToTab('Root.Main', new CheckboxField('HidePurchaseExam', 'Hide Purchase Exam Section')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideVirtualExam', 'Hide Virtual Exam Section')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideHowGetStarted', 'Hide How to get started Section')); $fields->addFieldToTab('Root.Main', new TextField('BannerTitle', 'Banner Title')); $fields->addFieldToTab('Root.Main', $banner_html = new HtmlEditorField('BannerText', 'Banner Text')); $banner_html->setRows(5); $fields->addFieldToTab('Root.Main', $how_html = new HtmlEditorField('GetStartedText', 'How to Get Started')); $how_html->setRows(5); $fields->addFieldToTab('Root.Main', new TextField('HandBookLink', 'HandBook Link')); $fields->addFieldToTab('Root.Main', new TextField('GetStartedURL', 'Get Started URL')); $fields->addFieldToTab('Root.Main', new TextField('GetStartedLabel', 'Get Started Label')); $fields->addFieldToTab('Root.Main', new TextField('AlreadyRegisteredURL', 'Already Registered URL')); // exam details $fields->addFieldToTab('Root.ExamDetails', $html_details = new HtmlEditorField('ExamDetails', 'Details Title')); $html_details->setRows(5); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamCost', 'Cost (include currency sign)')); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamDuration', 'Duration ( include time unit)')); $fields->addFieldToTab('Root.ExamDetails', $html_format = new HtmlEditorField('ExamFormat', 'Format')); $html_format->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_req = new HtmlEditorField('ExamIDRequirements', 'ID Requirements')); $html_req->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_system = new HtmlEditorField('ExamSystemRequirements', 'System Requirements')); $html_system->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_score = new HtmlEditorField('ExamScoring', 'Scoring')); $html_score->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_lang = new HtmlEditorField('ExamLanguage', 'Language')); $html_lang->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_duration = new HtmlEditorField('ExamHowLongSchedule', 'How long do I have to schedule my exam?')); $html_duration->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_retake = new HtmlEditorField('ExamRetake', 'Retake')); $html_retake->setRows(5); if ($this->ID > 0) { $logo_field = new UploadField('HeroImage', 'Hero Image'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('coa/hero_images/'); $logo_field->getValidator()->setAllowedMaxFileSize(1048576); $fields->addFieldToTab('Root.Main', $logo_field); $config = GridFieldConfig_RelationEditor::create(); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent($sort = new GridFieldSortableRows('Order')); $partners = new GridField('TrainingPartners', 'Training Partners', $this->TrainingPartners(), $config); $fields->addFieldsToTab('Root.TrainingPartners', $partners); } return $fields; }