public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $MapEmbedHTMLField = new TextareaField('MapEmbedHTML');
     $fields->addFieldToTab('Root.Main', $MapEmbedHTMLField, 'Content');
     return $fields;
 }
 /**
  * @return FieldSet
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowSubmittedList', 'Show the list of this user\'s submissions'));
     $fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowDraftList', 'Show the list of this user\'s draft submissions'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('AllowEditingComplete', 'Allow "Complete" submissions to be re-edited'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowSubmitButton', 'Show the submit button - if not checked, forms will be "submitted" as soon as all required fields are complete'));
     $fields->addFieldToTab('Root.FormOptions', new TextField('SubmitWarning', 'A warning to display to users when the submit button is clicked'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowPreviewButton', 'Show the buttons to preview the form'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowDeleteButton', 'Show the button to delete this form submission'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowButtonsOnTop', 'Show the form action buttons above the form as well as below'));
     $fields->addFieldToTab('Root.FormOptions', new CheckboxField('LoadLastSubmission', 'Automatically load the latest incomplete submission when a user visits the form'));
     $formFields = $this->Fields();
     $options = array();
     foreach ($formFields as $editableField) {
         $options[$editableField->Name] = $editableField->Title;
     }
     $fields->addFieldToTab('Root.FormOptions', $df = DropdownField::create('SubmissionTitleField', 'Title field to use for new submissions', $options));
     $df->setEmptyString('-- field --');
     $df->setRightTitle('Useful if submissions are to be listed somewhere and a sort field is required');
     if (class_exists('WorkflowDefinition')) {
         $definitions = WorkflowDefinition::get()->map();
         $field = DropdownField::create('WorkflowID', 'Submission workflow', $definitions)->setEmptyString('-- select a workflow --');
         $field->setRightTitle('Workflow to use for making a submission complete');
         $fields->addFieldToTab('Root.FormOptions', $field);
     }
     return $fields;
 }
Esempio n. 3
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = UploadField::create('ContactImage', 'Please upload an image to be displayed on your Contact Page. ')->setDescription('We recommend a <strong>360x482</strong> image.'));
     $uploadHeroField->setFolderName('Contact');
     $uploadHeroField->setAllowedFileCategories('image');
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Main Tab
     $fields->addFieldsToTab('Root.Main', array(HTMLEditorField::create('ExtraContent', 'Extra Content Area')), 'Metadata');
     // Google Map
     $fields->addFieldsToTab('Root.GoogleMap', array(TextField::create('GoogleMap', 'Google Map URL')));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Main Tab
     $fields->addFieldsToTab('Root.Main', array(HTMLEditorField::create('ExtraContent', 'Extra Content Area')), 'Metadata');
     $fields->addFieldsToTab('Root.Phone', array(GridField::create('Phones', 'Current phone number(s)', $this->Phones(), GridFieldConfig_RelationEditor::create()->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldAddNewInlineButton())->addComponent(new GridFieldOrderableRows()))));
     // Google Map
     $fields->addFieldsToTab('Root.GoogleMap', array(TextField::create('GoogleMap', 'Google Map URL')));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $gateways = GatewayInfo::get_supported_gateways();
     $amountfields = $this->Fields()->map("ID", "Title");
     $fields->addFieldsToTab("Root.Payment", array(DropdownField::create("PaymentAmountFieldID", "Payment Amount Field", $amountfields)->setDescription("This must return a value like 20.00 (no dollar sign)"), new DropdownField("PaymentGateway", "Payment Gateway", $gateways), new TextField("PaymentCurrency", "Payment Currency"), new CheckboxField("PaymentFields_Card", "Show Card Fields"), new CheckboxField("PaymentFields_Billing", "Show Billing Fields"), new CheckboxField("PaymentFields_Shipping", "Show Shipping Fields"), new CheckboxField("PaymentFields_Company", "Show Company Fields"), new CheckboxField("PaymentFields_Email", "Show Email Fields")));
     // text to show on error
     $onErrorFieldSet = new CompositeField($label = new LabelField('OnErrorMessageLabel', _t('UserDefinedForm.ONERRORLABEL', 'Show on error')), $editor = new HtmlEditorField("OnErrorMessage", "", _t('UserDefinedForm.ONERRORMESSAGE', $this->OnErrorMessage)));
     $onErrorFieldSet->addExtraClass('field');
     $fields->insertAfter($onErrorFieldSet, "OnCompleteMessage");
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Embargo
     $embargo = ToggleCompositeField::create('Embargo', 'Embargo', array(DateField::create('Starts', 'Allow participation from')->setRightTitle('Optional. If left blank, participation starts when page is published')->setConfig('showcalendar', true), DateField::create('Expires', 'Until')->setRightTitle('Optional. If left blank, participation will end when page is unpublished.')->setConfig('showcalendar', true)))->setStartClosed(false);
     $fields->addFieldToTab('Root.FormOptions', $embargo, 'SubmitButtonText');
     // Reports
     $config = GridFieldConfig_RecordEditor::create();
     $reports = GridField::create('Reports', 'Reports', $this->Reports(), $config);
     $fields->addFieldToTab('Root.Reports', $reports);
     return $fields;
 }
 public function getCMSFields()
 {
     Requirements::javascript(USERSUBMISSIONPAGES_DIR . '/javascript/userformpages.js');
     Requirements::css(USERSUBMISSIONPAGES_DIR . '/css/userformpages.css');
     $self = $this;
     $this->beforeUpdateCMSFields(function ($fields) use($self) {
         //
         // WARNING: Some of the fields here are moved with 'insertAfter' after
         //			$this->extend('updateCMSFields') is called, so their location is immutable.
         //			However, any other data to do with the field can be modified.
         //
         // Add dropdown that defines what page type gets created.
         $pageTypes = array();
         foreach (UserSubmissionExtension::get_classes_extending() as $class) {
             $pageTypes[$class] = singleton($class)->singular_name();
         }
         $field = null;
         if ($pageTypes && count($pageTypes) > 1) {
             $fields->push($field = DropdownField::create('SubmissionPageClassName', null, $pageTypes));
         } else {
             if ($pageTypes) {
                 // Seperated into *_Readonly so the value can look nice and use the 'singular_name'.
                 $fields->push($field = ReadonlyField::create('SubmissionPageClassName_Readonly', null, reset($pageTypes)));
             }
         }
         if ($field) {
             $field->setTitle('Submission Page Type');
             $field->setRightTitle('The page type to create underneath this page when a submission is approved.');
         }
         // Add dropdown that defines what field is used for the Page title of the published
         // submission listing items
         $userFields = $self->InputFields()->map('Name', 'Title');
         if (!$userFields instanceof ArrayList) {
             $userFields = $userFields->toArray();
         }
         if ($self->SubmissionPageTitleField && !isset($userFields[$self->SubmissionPageTitleField])) {
             // If set value isn't in dropdown, make it appear in there.
             $userFields[$self->SubmissionPageTitleField] = '<Field Deleted>';
         } else {
             if (!$self->SubmissionPageTitleField) {
                 $userFields = array_merge(array('' => '(Select Field)'), $userFields);
             }
         }
         $fields->push($field = DropdownField::create('SubmissionPageTitleField', 'Submission Page Title Field', $userFields));
         $field->setRightTitle('Be careful when modifying this value as it will change the "Title" and "Menu Title" of all your child pages.');
         // Update 'Submissions' gridfield to show the current state of a submission
         $submissionsGridField = $fields->dataFieldByName('Submissions');
         if ($submissionsGridField) {
             $class = $submissionsGridField->getList()->dataClass();
             $displayFields = ArrayLib::valuekey($class::config()->summary_fields);
             $displayFields['CMSState'] = 'State';
             $submissionsGridField->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields($displayFields);
         }
         // Add content
         $instructions = '';
         foreach ($self->ContentVariables() as $varname => $data) {
             $value = isset($data['Help']) ? $data['Help'] : $data['Value'];
             $instructions .= $varname . ' = ' . Convert::raw2xml($value) . '<br/>';
         }
         $field = $fields->dataFieldByName('Content');
         if ($field) {
             $field->setTitle($field->Title() . ' (Listing)');
             $field->setRightTitle($instructions);
         }
         $fields->addFieldToTab('Root.Submissions', NumericField::create('ItemsPerPage')->setRightTitle('If set to 0, then show all items.'));
         $fields->addFieldToTab('Root.Submissions', $field = HtmlEditorField::create('ContentAdd', 'Content (Form)'));
         $field->setRightTitle($instructions);
         // Add templating
         $fields->addFieldToTab('Root.Main', $field = TextareaField::create('TemplateHolderMarkup', 'Template Holder')->setRows(10));
         $fields->addFieldToTab('Root.Main', $field = TextareaField::create('TemplatePageMarkup', 'Template Page')->setRows(10));
         // Add search info
         if ($self->config()->enable_search_form) {
             $fields->addFieldToTab('Root.Main', $field = ReadonlyField::create('Search_EnableOnSearchForm_Readonly', 'Search Form Fields'));
             $field->setValue(implode(', ', $self->Fields()->filter('EnableOnSearchForm', true)->map('ID', 'Title')->toArray()));
             $field->setRightTitle('Fields that currently have "Show field on search form?" checked in their options.');
             $fields->addFieldToTab('Root.Main', $field = ReadonlyField::create('Search_UseInKeywordSearch_Readonly', 'Search Form Fields in Keyword Search'));
             $field->setValue(implode(', ', $self->Fields()->filter('UseInKeywordSearch', true)->map('ID', 'Title')->toArray()));
             $field->setRightTitle('Fields that currently have "Use for "Keywords" field search?" checked in their options.');
         }
         // Update Email Recipients gridfield to use custom email recipient class
         $gridField = $fields->dataFieldByName('EmailRecipients');
         if ($gridField) {
             $gridField->setModelClass('UserSubmissionHolder_EmailRecipient');
         }
     });
     $fields = parent::getCMSFields();
     if ($field = $fields->dataFieldByName('Search_UseInKeywordSearch_Readonly')) {
         $fields->insertAfter($field, 'Fields');
     }
     if ($field = $fields->dataFieldByName('Search_EnableOnSearchForm_Readonly')) {
         $fields->insertAfter($field, 'Fields');
     }
     if ($field = $fields->dataFieldByName('TemplatePageMarkup')) {
         $fields->insertAfter($field, 'Fields');
         $this->insertCMSTemplateAddFieldButtons($fields, 'TemplatePageMarkup');
     }
     if ($field = $fields->dataFieldByName('TemplateHolderMarkup')) {
         $fields->insertAfter($field, 'Fields');
         $this->insertCMSTemplateAddFieldButtons($fields, 'TemplateHolderMarkup');
     }
     if ($field = $fields->dataFieldByName('SubmissionPageTitleField')) {
         $fields->insertAfter($field, 'Fields');
     }
     if ($field = $fields->dataFieldByName('SubmissionPageClassName')) {
         $fields->insertAfter($field, 'Fields');
     }
     if ($field = $fields->dataFieldByName('SubmissionPageClassName_Readonly')) {
         $fields->insertAfter($field, 'Fields');
     }
     return $fields;
 }