public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Archived'); $fields->removeByName('Sort'); $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this news item?"), new CheckboxField('Archived', ''))); $group->addExtraClass("field special"); $label->addExtraClass("left"); $fields->removeByName('ParentID'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Archived'); $fields->removeByName('Sort'); $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this news item?"), new CheckboxField('Archived', ''))); $group->addExtraClass("field special"); $label->addExtraClass("left"); $fields->removeByName('ParentID'); $fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title"); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Archived'); $fields->addFieldToTab('Root.Main', new TreeDropdownField('LinkID', 'Link', 'SiteTree')); $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this carousel item?"), new CheckboxField('Archived', ''))); $group->addExtraClass("field special"); $label->addExtraClass("left"); $fields->removeByName('ParentID'); $fields->insertBefore($wrap = new CompositeField($extraLabel = new LabelField('Note', "Note: You will need to create the carousel item before you can add an image")), 'Image'); $wrap->addExtraClass('alignExtraLabel'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Archived'); $fields->removeByName('Sort'); $fields->insertAfter(LinkField::create('LinkID', 'Link'), "Title"); $fields->insertAfter($altText = TextField::create('AltText', 'Alternative text'), "Title"); $altText->setDescription("e.g. Sign up now!"); $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this promotional item?"), new CheckboxField('Archived', ''))); $group->addExtraClass("field special"); $label->addExtraClass("left"); $fields->removeByName('ParentID'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Order'); $fields->removeByName('ProcessInfo'); $fields->removeByName('StopStageID'); $fields->removeByName('StopButton'); $fields->removeByName('ContinueButton'); $fields->removeByName('DecisionPoint'); $fields->removeByName('CaseFinal'); $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header"> <span class="step-label"> <span class="flyout">3</span><span class="arrow"></span> <span class="title">Stage Settings</span> </span> </h3>'), 'Title'); $caseFinalMap = ProcessCase::get()->filter(array('ParentProcessID' => $this->ParentID))->map("ID", "Title")->toArray(); asort($caseFinalMap); $case = ListboxField::create('CaseFinal', 'Final step for these Cases')->setMultiple(true)->setSource($caseFinalMap)->setAttribute('data-placeholder', _t('ProcessAdmin.Cases', 'Cases', 'Placeholder text for a dropdown')); $fields->insertAfter($case, 'Title'); $fields->insertAfter($group = new CompositeField($label = new LabelField('switchLabel', 'Act as Decision Point'), new CheckboxField('DecisionPoint', '')), 'ParentID'); $group->addExtraClass("field special process-noborder"); $label->addExtraClass("left"); $fields->dataFieldByName('Content')->setRows(10); if ($this->ID > 0) { $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p></p>')); $fields->addFieldToTab('Root.Main', $processInfo = new CompositeField($grid = new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo()->sort(array('TypeID' => 'ASC', 'ProcessCaseID' => 'ASC', 'LinksToAnotherStageID' => 'ASC')), $gridConfig = GridFieldConfig_RelationEditor::create()))); $gridConfig->addComponent(new GridFieldSortableRows('Order')); $processInfo->addExtraClass('process-spacing'); $grid->addExtraClass('toggle-grid'); } else { $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p class="message info">Save this stage to add info</p>')); } $fields->insertBefore(new LiteralField('StageTitleInfo', '<h3 class="process-info-header"> <span class="step-label"> <span class="flyout">4</span><span class="arrow"></span> <span class="title">Information</span> </span> </h3>'), 'SaveRecord'); $stopStage = ProcessStopStage::get(); if ($stopStage) { $fields->insertBefore($inner = new CompositeField(new LiteralField('Decision', '<h3>Decision Point</h3>'), new LiteralField('ExplainStop', '<label class="right">Choose a stop stage if you would like this stage to act as a decision point</label>'), $stop = new DropdownField('StopStageID', 'Stop Stage', $stopStage->map('ID', 'Title')), $continue = new TextField('ContinueButton', 'Button: Continue (e.g. "Yes")'), new TextField('StopButton', 'Button: Stop (e.g. "No")')), 'ProcessInfo'); $stop->setEmptyString('No stop after this stage'); $inner->addExtraClass('message special toggle-decide'); $continue->addExtraClass('process-noborder'); $stop->addExtraClass('process-noborder'); } return $fields; }
/** * Returns a FieldList of cms form fields that is the main form for editing this DataObject * * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); // Hide these from editing $fields->removeByName('ParentID'); $fields->removeByName('Sort'); $image = $fields->dataFieldByName('SplashImage'); $image->setFolderName('Uploads/Splash-Images'); $fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title"); $fields->removeByName('HideFromRegionLists'); // Archived $fields->removeByName('Archived'); $fields->addFieldToTab('Root.Main', $group = new CompositeField($labelHide = new LabelField("LabelHideFromRegionLists", "Hide from region lists?"), new CheckboxField('HideFromRegionLists', "e.g. if you need a region for an event that isn't a branch location"), $label = new LabelField("LabelArchive", "Archive this region?"), new CheckboxField('Archived', ''))); $labelHide->addExtraClass("left"); $group->addExtraClass("special field"); $label->addExtraClass("left"); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->insertAfter($gameFormContent = new HTMLEditorField('GameLiveContent', 'Game selection form detail'), 'Content'); $gameFormContent->setRows(20); $regOpen = new CheckboxField('OpenGameReg', ''); $fields->insertBefore($cField = new CompositeField(array($label = new LabelField('OpenGameRegLabel', 'Open game selection (all)'), $regOpen)), 'Content'); $cField->addExtraClass('field'); $regOpen->addExtraClass('mts'); $label->addExtraClass('left'); $groupsMap = array(); foreach (Group::get() as $group) { // Listboxfield values are escaped, use ASCII char instead of » $groupsMap[$group->ID] = $group->getBreadcrumbs(' > '); } asort($groupsMap); $fields->insertBefore(ListboxField::create('OpenGameRegForGroups', "Open game selection for group (limited)")->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('Member.ADDGROUP', 'Add group', 'Placeholder text for a dropdown')), 'Content'); return $fields; }
/** * Returns a FieldList of cms form fields * * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); // Hide these from editing $fields->removeByName('ParentID'); $fields->removeByName('Sort'); //Remove to re-add $fields->removeByName('Type'); $fields->removeByName('LinkLabel'); $content = $fields->dataFieldByName('Content'); $numberToDisplay = $fields->dataFieldByName('NumberToDisplay'); $projectPage = $fields->dataFieldByName('ProjectPageID'); $html = $fields->dataFieldByName('HTML'); $subtitle = $fields->dataFieldByName('SubTitle'); $html->setRows(20); $html->addExtraClass('no-pagebreak'); $link = $fields->dataFieldByName('LinkID'); $image = $fields->dataFieldByName('Image'); $image->setFolderName('Uploads/Small-Images'); $fields->removeByName('Image'); $fields->insertBefore($projectPage, 'Content'); $fields->insertAfter($type = OptionSetField::create("Type", "Type", $this->dbObject('Type')->enumValues()), "Colour"); $type->addExtraClass('inline-short-list'); $fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Title"); $fields->insertAfter($linkLabel = new TextField("LinkLabel", "Link Label"), "LinkID"); $fields->insertAfter($imageLogin = DisplayLogicWrapper::create($image), 'LinkLabel'); $imageLogin->hideUnless("Type")->isEqualTo("Content"); $html->hideUnless("Type")->isEqualTo("HTML"); $subtitle->hideUnless("Type")->isEqualTo("HTML"); $link->hideUnless("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("Project"); $linkLabel->hideUnless("LinkID")->isGreaterThan(0)->andIf("Type")->isEqualTo("Content"); $numberToDisplay->hideIf("Type")->isEqualTo("Content")->orIf("Type")->isEqualTo("HTML"); $projectPage->hideUnless("Type")->isEqualTo("Project"); $content->hideUnless("Type")->isEqualTo("Content"); // Archived $fields->removeByName('Archived'); $fields->addFieldToTab('Root.Main', $group = new CompositeField($label = new LabelField("LabelArchive", "Archive this feature?"), new CheckboxField('Archived', ''))); $group->addExtraClass("special field"); $label->addExtraClass("left"); return $fields; }
/** * @param FieldList $fields */ protected function setDeployConfigurationFields(&$fields) { if (!$this->config()->get('allow_web_editing')) { return; } if ($this->envFileExists()) { $deployConfig = new TextareaField('DeployConfig', 'Deploy config', $this->getEnvironmentConfig()); $deployConfig->setRows(40); $fields->insertAfter($deployConfig, 'Filename'); return; } $warning = 'Warning: This environment doesn\'t have deployment configuration.'; $noDeployConfig = new LabelField('noDeployConfig', $warning); $noDeployConfig->addExtraClass('message warning'); $fields->insertAfter($noDeployConfig, 'Filename'); $createConfigField = new CheckboxField('CreateEnvConfig', 'Create Config'); $createConfigField->setDescription('Would you like to create the capistrano deploy configuration?'); $fields->insertAfter($createConfigField, 'noDeployConfig'); }
/** * If there isn't a capistrano env project folder, show options to create one * * @param FieldList $fields */ public function setCreateProjectFolderField(&$fields) { // Check if the capistrano project folder exists if (!$this->Name) { return; } if ($this->projectFolderExists()) { return; } $createFolderNotice = new LabelField('CreateEnvFolderNotice', 'Warning: No Capistrano project folder exists'); $createFolderNotice->addExtraClass('message warning'); $fields->insertBefore($createFolderNotice, 'Name'); $createFolderField = new CheckboxField('CreateEnvFolder', 'Create folder'); $createFolderField->setDescription('Would you like to create the capistrano project folder?'); $fields->insertAfter($createFolderField, 'CreateEnvFolderNotice'); }
/** * @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; }