function updateCMSFields(&$fields) { /* * don't want slideshow on a redirector page */ if ($this->owner->ClassName == 'RedirectorPage') { return $fields; } /* * if this is a new page set defaults */ if ($this->owner->Version == 1) { $this->set_defaults(); } $tabSlides = new Tab('Slides'); $tabSlides->setTitle(_t('Slideshow.SLIDESTABTITLE', 'Slides')); $tabSettings = new Tab('Settings'); $tabSettings->setTitle(_t('Slideshow.SETTINGSTABTITLE', 'Settings')); $tabSlideShow = new TabSet('SlideshowTabs', $tabSlides, $tabSettings); $tabSlideShow->setTitle(_t('Slideshow.SLIDESHOWTABTITLE', 'Slideshow')); $fields->addFieldToTab('Root.Content', $tabSlideShow); $image_manager = new ImageDataObjectManager($this->owner, 'SlideshowSlides', 'SlideshowSlide', 'SlideImage', array(), 'getCMSFields_forPopup'); $image_manager->copyOnImport = false; $fields->addFieldToTab('Root.Content.SlideshowTabs.Slides', $image_manager); /* * settings */ if (count(self::$effects) > 1) { $fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new DropdownField($name = 'SlideEffect', $title = _t('Slideshow.EFFECT', 'Slide effect'), $source = array_combine(array_keys(self::$effects), array_keys(self::$effects)))); } else { $fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new HiddenField($name = 'SlideEffect', $title = 'Slide Effect', $value = key(self::$effects))); } $fields->addFieldsToTab('Root.Content.SlideshowTabs.Settings', array(new TextField($name = 'SlideDuration', $title = _t('Slideshow.SLIDEDURATIOM', 'Duration of Each Slide (milliseconds)')), new TextField($name = 'TransitionDuration', $title = _t('Slideshow.TRANSITIONDURATION', 'Duration of Transition Between Slides (milliseconds)')), new CheckboxField($name = 'AutoPlay', $title = _t('Slideshow.AUTOPLAY', 'Start slideshow automatically')), new CheckboxField($name = 'Loop', $title = _t('Slideshow.LOOP', 'Loop slides')), new CheckboxField($name = 'PauseOnHover', $title = _t('Slideshow.PAUSEONHOVER', 'Pause the slideshow when the mouse hovers over it')), new OptionsetField($name = 'UpdateSlideshows', $title = _t('Slideshow.UPDATE', 'Update slideshows'), $source = array('page' => _t('Slideshow.UPDATEPAGEONLY', 'Apply to this page only'), 'section' => _t('Slideshow.UPDATESECTION', 'Apply to all slideshows in this section'), 'site' => _t('Slideshow.UPDATEALL', 'Apply to all slideshows on this site')), $value = 'page'))); }
public function getEditForm($id = null, $fields = null) { // TODO Duplicate record fetching (see parent implementation) if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); // TODO Duplicate record fetching (see parent implementation) $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldButtonRow('after'))->addComponent(new GridFieldExportButton('buttons-after-left')))->addExtraClass("members_grid"); if ($record && method_exists($record, 'getValidator')) { $validator = $record->getValidator(); } else { $validator = Injector::inst()->get('Member')->getValidator(); } $memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator); $groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create()); $columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns'); $columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title'))); $columns->setFieldFormatting(array('Breadcrumbs' => function ($val, $item) { return Convert::raw2xml($item->getBreadcrumbs(' > ')); })); $fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList)), new HiddenField('ID', false, 0)); // Add import capabilities. Limit to admin since the import logic can affect assigned permissions if (Permission::check('ADMIN')) { $fields->addFieldsToTab('Root.Users', array(new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('memberimport'))))); $fields->addFieldsToTab('Root.Groups', array(new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('groupimport'))))); } // Tab nav in CMS is rendered through separate template $root->setTemplate('CMSTabSet'); // Add roles editing interface if (Permission::check('APPLY_ROLES')) { $rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create()); $rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles')); $rolesTab->push($rolesField); } $actionParam = $this->getRequest()->param('Action'); if ($actionParam == 'groups') { $groupsTab->addExtraClass('ui-state-active'); } elseif ($actionParam == 'users') { $usersTab->addExtraClass('ui-state-active'); } elseif ($actionParam == 'roles') { $rolesTab->addExtraClass('ui-state-active'); } $actions = new FieldList(); $form = Form::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm'); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); // Tab nav in CMS is rendered through separate template if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); } $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); $form->setAttribute('data-pjax-fragment', 'CurrentForm'); $this->extend('updateEditForm', $form); return $form; }
/** * @return Form */ public function getEditForm($id = null, $fields = null) { if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $commentsConfig = GridFieldConfig::create()->addComponents(new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldSortableHeader(), new GridFieldPaginator(25), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldExportButton(), new GridFieldEditButton(), new GridFieldDetailForm()); $needs = new GridField('Comments', _t('CommentsAdmin.NeedsModeration', 'Needs Moderation'), Comment::get()->where('Moderated = 0'), $commentsConfig); $moderated = new GridField('CommentsModerated', _t('CommentsAdmin.CommentsModerated'), Comment::get()->where('Moderated = 1'), $commentsConfig); $fields = new FieldList($root = new TabSet('Root', new Tab('NeedsModeration', _t('CommentAdmin.NeedsModeration', 'Needs Moderation'), $needs), new Tab('Comments', _t('CommentAdmin.Moderated', 'Moderated'), $moderated))); $root->setTemplate('CMSTabSet'); $actions = new FieldList(); $form = new Form($this, 'EditForm', $fields, $actions); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); } $this->extend('updateEditForm', $form); return $form; }
/** * @return Form */ public function getEditForm($id = null, $fields = null) { if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $newComments = Comment::get()->filter('Moderated', 0); $newGrid = new CommentsGridField('NewComments', _t('CommentsAdmin.NewComments', 'New'), $newComments, CommentsGridFieldConfig::create()); $approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0); $approvedGrid = new CommentsGridField('ApprovedComments', _t('CommentsAdmin.ApprovedComments', 'Approved'), $approvedComments, CommentsGridFieldConfig::create()); $spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1); $spamGrid = new CommentsGridField('SpamComments', _t('CommentsAdmin.SpamComments', 'Spam'), $spamComments, CommentsGridFieldConfig::create()); $newCount = '(' . count($newComments) . ')'; $approvedCount = '(' . count($approvedComments) . ')'; $spamCount = '(' . count($spamComments) . ')'; $fields = new FieldList($root = new TabSet('Root', new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount, $newGrid), new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount, $approvedGrid), new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount, $spamGrid))); $root->setTemplate('CMSTabSet'); $actions = new FieldList(); $form = new Form($this, 'EditForm', $fields, $actions); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); } $this->extend('updateEditForm', $form); return $form; }
function ItemEditForm() { $form = parent::ItemEditForm(); $actions = $form->Actions(); $majorActions = CompositeField::create()->setName('MajorActions')->setTag('fieldset')->addExtraClass('ss-ui-buttonset'); $rootTabSet = new TabSet('ActionMenus'); $moreOptions = new Tab('MoreOptions', _t('SiteTree.MoreOptions', 'More options', 'Expands a view for more buttons')); $rootTabSet->push($moreOptions); $rootTabSet->addExtraClass('ss-ui-action-tabset action-menus'); // Render page information into the "more-options" drop-up, on the top. $baseClass = ClassInfo::baseDataClass($this->record->class); $live = Versioned::get_one_by_stage($this->record->class, 'Live', "\"{$baseClass}\".\"ID\"='{$this->record->ID}'"); $existsOnLive = $this->record->getExistsOnLive(); $published = $this->record->isPublished(); $moreOptions->push(new LiteralField('Information', $this->record->customise(array('Live' => $live, 'ExistsOnLive' => $existsOnLive))->renderWith('SiteTree_Information'))); $actions->removeByName('action_doSave'); $actions->removeByName('action_doDelete'); if ($this->record->canEdit()) { if ($this->record->IsDeletedFromStage) { if ($existsOnLive) { $majorActions->push(FormAction::create('revert', _t('CMSMain.RESTORE', 'Restore'))); if ($this->record->canDelete() && $this->record->canDeleteFromLive()) { $majorActions->push(FormAction::create('unpublish', _t('CMSMain.DELETEFP', 'Delete'))->addExtraClass('ss-ui-action-destructive')); } } else { if (!$this->record->isNew()) { $majorActions->push(FormAction::create('restore', _t('CMSMain.RESTORE', 'Restore'))->setAttribute('data-icon', 'decline')); } else { $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true)); $majorActions->push(FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true)); } } } else { if ($this->record->canDelete() && !$published) { $moreOptions->push(FormAction::create('delete', _t('SiteTree.BUTTONDELETE', 'Delete draft'))->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true)); } $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true)); } } $publish = FormAction::create('publish', $published ? _t('SiteTree.BUTTONPUBLISHED', 'Published') : _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true); if (!$published || $this->record->stagesDiffer('Stage', 'Live') && $published) { $publish->addExtraClass('ss-ui-alternate'); } if ($this->record->canPublish() && !$this->record->IsDeletedFromStage) { $majorActions->push($publish); } if ($published && $this->record->canPublish() && !$this->record->IsDeletedFromStage && $this->record->canDeleteFromLive()) { $moreOptions->push(FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true)); } if ($this->record->stagesDiffer('Stage', 'Live') && !$this->record->IsDeletedFromStage && $this->record->isPublished() && $this->record->canEdit()) { $moreOptions->push(FormAction::create('rollback', _t('SiteTree.BUTTONCANCELDRAFT', 'Cancel draft changes'))->setDescription(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page'))->setUseButtonTag(true)); } $actions->push($majorActions); $actions->push($rootTabSet); if ($this->record->hasMethod('getCMSValidator')) { $form->setValidator($this->record->getCMSValidator()); } return $form; }
public function ID() { if ($this->tabSet) { return $this->tabSet->ID() . '_' . $this->id; } else { return $this->id; } }
public function getCMSFields() { $fields = parent::getCMSFields(); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); Requirements::javascript('memberprofiles/javascript/MemberProfilePageCms.js'); // Setup tabs $fields->addFieldToTab('Root', $profile = new TabSet('Profile'), 'Content'); $fields->addFieldToTab('Root', $email = new Tab('Email'), 'Behaviour'); $profile->setTitle(_t('MemberProfiles.PROFILE', 'Profile')); $email->setTitle(_t('MemberProfiles.EMAIL', 'Email')); $fields->findOrMakeTab('Root.Profile.Fields', _t('MemberProfiles.FIELDS', 'Fields')); $fields->findOrMakeTab('Root.Profile.Groups', _t('MemberProfiles.GROUPS', 'Groups')); $fields->findOrMakeTab('Root.Profile.PublicProfile', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile')); // Profile fields $fields->addFieldsToTab('Root.Profile.Fields', array(new HeaderField('ProfileFieldsHeader', _t('MemberProfiles.PROFILEFIELDS', 'Profile Fields')), $table = new OrderableComplexTableField($this, 'Fields', 'MemberProfileField'))); $table->setPermissions(array('show', 'edit')); $table->setCustomSourceItems($this->getProfileFields()); // Groups $fields->addFieldsToTab('Root.Profile.Groups', array(new HeaderField('GroupsHeader', _t('MemberProfiles.GROUPASSIGNMENT', 'Group Assignment')), new LiteralField('GroupsNote', '<p>' . _t('MemberProfiles.GROUPSNOTE', 'Any users registering via this page will always be added to ' . 'the below groups (if registration is enabled). Conversely, a ' . 'member must belong to these groups in order to edit their ' . 'profile on this page.') . '</p>'), new CheckboxSetField('Groups', '', DataObject::get('Group')->map()), new HeaderField('SelectableGroupsHeader', _t('MemberProfiles.USERSELECTABLE', 'User Selectable')), new LiteralField('SelectableGroupsNote', '<p>' . _t('MemberProfiles.SELECTABLEGROUPSNOTE', 'Users can choose to belong to the following groups, if the ' . '"Groups" field is enabled in the "Fields" tab.') . '</p>'), new CheckboxSetField('SelectableGroups', '', DataObject::get('Group')->map()))); // Public profile $fields->addFieldsToTab('Root.Profile.PublicProfile', array(new HeaderField('PublicProfileHeader', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile')), new CheckboxField('AllowProfileViewing', _t('MemberProfiles.ALLOWPROFILEVIEWING', 'Allow people to view user profiles.')), new HeaderField('ProfileSectionsHeader', _t('MemberProfiles.PROFILESECTIONS', 'Profile Sections')), new MemberProfileSectionField($this, 'Sections', 'MemberProfileSection'))); // Email confirmation and validation $fields->addFieldsToTab('Root.Email', array(new HeaderField('EmailHeader', 'Email Confirmation and Validation'), new OptionSetField('EmailType', '', array('Validation' => 'Require email validation to activate an account', 'Confirmation' => 'Send a confirmation email after a user registers', 'None' => 'Do not send any emails')), new ToggleCompositeField('EmailContent', 'Email Content', array(new TextField('EmailSubject', 'Email subject'), new TextField('EmailFrom', 'Email from'), new TextareaField('EmailTemplate', 'Email template'), new LiteralField('TemplateNote', MemberConfirmationEmail::TEMPLATE_NOTE))), new ToggleCompositeField('ConfirmationContent', 'Confirmation Content', array(new LiteralField('ConfirmationNote', '<p>This content is dispayed when a user confirms their account.</p>'), new TextField('ConfirmationTitle', 'Title'), new HtmlEditorField('ConfirmationContent', 'Content'))))); // Content $fields->removeFieldFromTab('Root.Content.Main', 'Content'); $fields->addFieldToTab('Root.Content', $profileContent = new Tab('Profile'), 'Metadata'); $fields->addFieldToTab('Root.Content', $regContent = new Tab('Registration'), 'Metadata'); $fields->addFieldToTab('Root.Content', $afterReg = new Tab('AfterRegistration'), 'Metadata'); $profileContent->setTitle(_t('MemberProfiles.PROFILE', 'Profile')); $regContent->setTitle(_t('MemberProfiles.REGISTRATION', 'Registration')); $afterReg->setTitle(_t('MemberProfiles.AFTERREG', 'After Registration')); $tabs = array('Profile', 'Registration', 'AfterRegistration'); foreach ($tabs as $tab) { $fields->addFieldsToTab("Root.Content.{$tab}", array(new TextField("{$tab}Title", _t('MemberProfiles.TITLE', 'Title')), new HtmlEditorField("{$tab}Content", _t('MemberProfiles.CONTENT', 'Content')))); } $fields->addFieldToTab('Root.Content.AfterRegistration', new CheckboxField('RegistrationRedirect', _t('MemberProfiles.REDIRECT_AFTER_REG', 'Redirect after registration?')), 'AfterRegistrationContent'); $fields->addFieldToTab('Root.Content.AfterRegistration', new TreeDropdownField('PostRegistrationTargetID', _t('MemberProfiles.REDIRECT_TARGET', 'Redirect to page'), 'SiteTree'), 'AfterRegistrationContent'); // Behaviour $fields->addFieldToTab('Root.Behaviour', new HeaderField('ProfileBehaviour', _t('MemberProfiles.PROFILEBEHAVIOUR', 'Profile Behaviour')), 'ClassName'); $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowRegistration', _t('MemberProfiles.ALLOWREG', 'Allow registration via this page')), 'ClassName'); $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowProfileEditing', _t('MemberProfiles.ALLOWEDITING', 'Allow users to edit their own profile on this page')), 'ClassName'); $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowAdding', _t('MemberProfiles.ALLOWADD', 'Allow members with member creation permissions to add members via this page')), 'ClassName'); $requireApproval = new CheckboxField('RequireApproval', _t('MemberProfiles.REQUIREREGAPPROVAL', 'Require registration approval by an administrator?')); $fields->addFieldToTab('Root.Behaviour', $requireApproval, 'ClassName'); $approvalGroups = _t('MemberProfiles.NOTIFYTHESEGROUPS', 'Notify these groups to approve new registrations'); $approvalGroups = new TreeMultiselectField('ApprovalGroups', $approvalGroups, 'Group'); $fields->addFieldToTab('Root.Behaviour', $approvalGroups, 'ClassName'); $pageSettings = new HeaderField('PageSettingsHeader', _t('MemberProfiles.PAGEBEHAVIOUR', 'Page Behaviour')); $fields->addFieldToTab('Root.Behaviour', $pageSettings, 'ClassName'); return $fields; }
/** * This method should be overloaded to build out the detail form. * * @return Form */ public function Form() { $form = new Form($this, 'Form', new FieldList($root = new TabSet('Root', new Tab('Main'))), new FieldList()); if ($this->getTopLevelController() instanceof LeftAndMain) { $form->setTemplate('LeftAndMain_EditForm'); $form->addExtraClass('cms-content cms-edit-form cms-tabset center'); $form->setAttribute('data-pjax-fragment', 'CurrentForm Content'); $root->setTemplate('CMSTabSet'); $form->Backlink = $this->getBackLink(); } return $form; }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab('Root', Tab::create("GoogleAnalytics", _t('GoogleAnalyzer.TABTITLE', "Google Analytics"))); $fields->addFieldToTab("Root.GoogleAnalytics", TabSet::create("Stats", _t('GoogleAnalyzer.STATS', "Stats"))); $fields->addFieldToTab('Root.GoogleAnalytics.Stats', Tab::create("Performance", _t('GoogleAnalyzer.PERFORMANCE', "Performance"))); $fields->addFieldToTab("Root.GoogleAnalytics.Stats.Performance", new GooglePerformanceChart($this->owner)); }
function getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldToTab('Root.Main', new TextField('Title')); $fields->addFieldToTab('Root.Main', new CurrencyField('Price')); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TabSet::create('Root'))->text('Title')->text('Code', 'Code', '', 5)->textarea('Description')->numeric('SessionCount', 'Number of sessions')->numeric('AlternateCount', 'Number of alternates')->checkbox('VotingVisible', "This category is visible to voters")->checkbox('ChairVisible', "This category is visible to track chairs")->hidden('SummitID', 'SummitID'); if ($this->ID > 0) { //tags $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType(new GridFieldDataColumns()); $config->removeComponentsByType(new GridFieldDetailForm()); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setResultsFormat('$Tag'); $completer->setSearchFields(array('Tag')); $completer->setSearchList(Tag::get()); $editconf = new GridFieldDetailForm(); $editconf->setFields(FieldList::create(TextField::create('Tag', 'Tag'), DropdownField::create('ManyMany[Group]', 'Group', array('topics' => 'Topics', 'speaker' => 'Speaker', 'openstack projects mentioned' => 'OpenStack Projects Mentioned')))); $summaryfieldsconf = new GridFieldDataColumns(); $summaryfieldsconf->setDisplayFields(array('Tag' => 'Tag', 'Group' => 'Group')); $config->addComponent($editconf); $config->addComponent($summaryfieldsconf, new GridFieldFilterHeader()); $tags = new GridField('AllowedTags', 'Tags', $this->AllowedTags(), $config); $fields->addFieldToTab('Root.Main', $tags); // extra questions for call-for-presentations $config = new GridFieldConfig_RelationEditor(); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('TrackTextBoxQuestionTemplate' => 'TextBox', 'TrackCheckBoxQuestionTemplate' => 'CheckBox', 'TrackCheckBoxListQuestionTemplate' => 'CheckBoxList', 'TrackRadioButtonListQuestionTemplate' => 'RadioButtonList', 'TrackDropDownQuestionTemplate' => 'ComboBox', 'TrackLiteralContentQuestionTemplate' => 'Literal')); $config->addComponent($multi_class_selector); $questions = new GridField('ExtraQuestions', 'Track Specific Questions', $this->ExtraQuestions(), $config); $fields->addFieldToTab('Root.Main', $questions); } return $fields; }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { /** ========================================= * @var TextareaField $address * @var TextareaField $postalAddress * @var TextField $mailChimpAPI * @var TextareaField $mailChimpSuccessMessage ===========================================*/ if (!$fields->fieldByName('Root.Settings')) { $fields->addFieldToTab('Root', TabSet::create('Settings')); } /** ----------------------------------------- * Details * ----------------------------------------*/ $address = TextareaField::create('Address', 'Address'); $address->setRows(8); $postalAddress = TextareaField::create('PostalAddress', 'Postal Address'); $postalAddress->setRows(8); $fields->findOrMakeTab('Root.Settings.Details'); $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle'))); /** ----------------------------------------- * Subscription * ----------------------------------------*/ $mailChimpAPI = TextField::create('MailChimpAPI', 'API Key'); $mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)'); $mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>'); $mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.'); $fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription'); $fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage)); }
/** * getCMSFields * Construct the FieldList used in the CMS. To provide a * smarter UI we don't use the scaffolding provided by * parent::getCMSFields. * * @return FieldList */ public function getCMSFields() { Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css'); //Create the FieldList and push the Root TabSet on to it. $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?"))))); return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->insertBefore($shoptab = Tab::create('Shop', 'Shop'), 'Access'); $fields->addFieldsToTab("Root.Shop", TabSet::create("ShopTabs", $maintab = Tab::create("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = Tab::create("Countries", CheckboxSetField::create('AllowedCountries', _t('ShopConfig.ALLOWED_COUNTRIES', 'Allowed Ordering and Shipping Countries'), self::config()->iso_3166_country_codes)))); $fields->removeByName("CreateTopLevelGroups"); $countriestab->setTitle(_t('ShopConfig.ALLOWED_COUNTRIES_TAB_TITLE', "Allowed Countries")); }
/** * @return FieldList */ public function getCMSFields() { /** ========================================= * @var FieldList $fields * @var FieldGroup $settings * @var UploadField $image * @var GridFieldConfig_RelationEditor $config * @var GridField $gridField ===========================================*/ $fields = FieldList::create(TabSet::create('Root')); $fields->addfieldToTab('Root.Main', $title = TextField::create('Title')); $title->setRightTitle('Title used in the cms as a visual cue for this piece of content.'); $fields->addFieldToTab('Root.Main', $settings = FieldGroup::create(array(CheckboxField::create('IsFullWidth', 'Container full width')))); $settings->setTitle('Settings'); $fields->addFieldToTab('Root.Main', HeaderField::create('', 'Style')); $fields->addFieldToTab('Root.Main', DesignField::create('Style', 'Container', '.container', array('padding-top' => 'TextField', 'padding-bottom' => 'TextField', 'margin-top' => 'TextField', 'margin-bottom' => 'TextField', 'color' => 'ColorField', 'background' => 'ColorField'))); $fields->addFieldToTab('Root.Main', HeaderField::create('', 'Background (optional)', 4)); $fields->addFieldToTab('Root.Main', $image = UploadField::create('Image', _t('PageBuilderContainer.IMAGE', 'Image'))); $image->setAllowedExtensions(array('jpeg', 'jpg', 'gif', 'png')); $image->setFolderName('Uploads/site-builder/containers'); $fields->addFieldToTab('Root.Main', DropdownField::create('BackgroundType', 'Type', $this->dbObject('BackgroundType')->enumValues())); $config = GridFieldConfig_RelationEditor::create(10); $config->addComponent(GridFieldOrderableRows::create('SortOrder'))->addComponent(new GridFieldDeleteAction()); $gridField = GridField::create('Items', 'Items', $this->Items(), $config); $gridField->addExtraClass('hide'); $fields->addFieldToTab('Root.Main', $gridField); return $fields; }
/** * Create a new instance of SplitButton * @param string $name Form field name * @param string $title Title that will be displayed on the split button. * if not provided, the title will be guess from the `$name`. */ public function __construct($name, $title = null) { $args = func_get_args(); $name = array_shift($args); if ($args) { $title = array_shift($args); } // Guess the title if none provided if (!$title) { $title = self::name_to_label($name); } // Instanciate our undelying tab container $this->tab = new Tab('SplitButtonTab', $title); //Call the parent consturctor parent::__construct($name, $this->tab); // Add the same class as the _more options_ link so we can piggy back // off that logic. $this->addExtraClass('ss-ui-action-tabset action-menus ss-ui-button'); // Add any provided button. if ($args) { foreach ($args as $button) { // Make sure we only add Form Fields to our tab. $isValidArg = is_object($button) && !$button instanceof FormField; if (!$isValidArg) { user_error('SplitButton::__construct(): Parameter not a valid FormField instance', E_USER_ERROR); } $this->tab->push($button); } } // Define a custom spread sheet so we can style our button. Requirements::css(EXCELEXPORT_DIR . '/css/splitbutton.css'); }
/** * getCMSFields * Construct the FieldList used in the CMS. To provide a * smarter UI we don't use the scaffolding provided by * parent::getCMSFields. * * @return FieldList */ public function getCMSFields() { Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css'); //Create the FieldList and push the Root TabSet on to it. $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?"))))); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldToTab('Root.Main', new DropdownField('Type', 'Type', $this->dbObject('Type')->enumValues())); $fields->addFieldToTab('Root.Main', new TextField('Name', 'Name')); $fields->addFieldToTab('Root.Main', new TextareaField('Description', 'Description')); $fields->addFieldToTab('Root.Main', new TextareaField('Address', 'Address')); $fields->addFieldToTab('Root.Main', new TextField('Latitude', 'Latitude')); $fields->addFieldToTab('Root.Main', new TextField('Longitude', 'Longitude')); $fields->addFieldToTab('Root.Main', new TextField('LocationMessage', 'Message to display for this location')); $fields->addFieldToTab('Root.Main', new TextField('Website', 'Website')); $fields->addFieldToTab('Root.Main', new TextField('BookingLink', 'BookingLink')); $start_date = new DatetimeField('BookingStartDate', 'Booking Block - Start Date'); $start_date->getDateField()->setConfig('showcalendar', true); $start_date->setConfig('dateformat', 'dd/MM/yyyy'); $fields->addFieldToTab('Root.Main', $start_date); $end_date = new DatetimeField('BookingEndDate', 'Booking Block - End Date'); $end_date->getDateField()->setConfig('showcalendar', true); $end_date->setConfig('dateformat', 'dd/MM/yyyy'); $fields->addFieldToTab('Root.Main', $end_date); $fields->addFieldToTab('Root.Main', new TextField('InRangeBookingGraphic', 'URL of graphic of an in range stay')); $fields->addFieldToTab('Root.Main', new TextField('OutOfRangeBookingGraphic', 'URL of graphic of an out of range stay')); $fields->addFieldToTab('Root.Main', new CheckboxField('IsSoldOut', 'This location is <strong>sold out</strong> (applies to hotels only)')); $fields->addFieldToTab('Root.Main', new CheckboxField('DisplayOnSite', 'Show this location on the website. Will be hidden if unchecked.')); $fields->addFieldToTab('Root.Main', new CheckboxField('DetailsPage', 'Send people to a details page first?')); $fields->addFieldToTab('Root.Main', new TextField('DistanceFromVenue', 'Distance From Venue')); $fields->addFieldToTab('Root.Main', new TextField('PublicTransitInstructions', 'Public Transit Instructions')); return $fields; }
/** * @return FieldList */ public function getCMSFields() { // Get NotifiedOn implementors $types = ClassInfo::implementorsOf('NotifiedOn'); $types = array_combine($types, $types); unset($types['NotifyOnThis']); if (!$types) { $types = array(); } array_unshift($types, ''); // Available keywords $keywords = $this->getKeywords(); if (count($keywords)) { $availableKeywords = '<div class="field"><div class="middleColumn"><p><u>Available Keywords:</u> </p><ul><li>$' . implode('</li><li>$', $keywords) . '</li></ul></div></div>'; } else { $availableKeywords = "Available keywords will be shown if you select a NotifyOnClass"; } // Identifiers $identifiers = $this->config()->get('identifiers'); if (count($identifiers)) { $identifiers = array_combine($identifiers, $identifiers); } $fields = FieldList::create(); $relevantMsg = 'Relevant for (note: this notification will only be sent if the context of raising the notification is of this type)'; $fields->push(TabSet::create('Root', Tab::create('Main', DropdownField::create('Identifier', _t('SystemNotification.IDENTIFIER', 'Identifier'), $identifiers), TextField::create('Title', _t('SystemNotification.TITLE', 'Title')), TextField::create('Description', _t('SystemNotification.DESCRIPTION', 'Description')), DropdownField::create('NotifyOnClass', _t('SystemNotification.NOTIFY_ON_CLASS', $relevantMsg), $types), TextField::create('CustomTemplate', _t('SystemNotification.TEMPLATE', 'Template (Optional)'))->setAttribute('placeholder', $this->config()->get('default_template')), LiteralField::create('AvailableKeywords', $availableKeywords)))); if ($this->config()->html_notifications) { $fields->insertBefore(HTMLEditorField::create('NotificationHTML', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords'); } else { $fields->insertBefore(TextareaField::create('NotificationText', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords'); } return $fields; }
public function getCMSFields() { if ($this->ID == 0) { $categorydropdown = TextField::create('CategoryDisclaimer')->setTitle('Category')->setDisabled(true)->setValue('You can assign a category once you have saved the record for the first time.'); } else { $categories = ListCategory::get()->filter("ListPageID", "{$this->ListPageID}")->sort("Category ASC"); $map = $categories ? $categories->map('ID', 'Category', 'Please Select') : array(); if ($map) { $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map); $categorydropdown->setEmptyString("-- Please Select --"); } else { $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map); $categorydropdown->setEmptyString("There are no categories created yet"); } } $ImageField = UploadField::create('Photo')->setDescription('(Allowed filetypes: jpg, jpeg, png, gif)'); $ImageField->folderName = 'ListPage'; $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png'); $DocumentField = UploadField::create('Resource')->setTitle('Resource/Document')->setDescription('(Allowed filetypes: pdf, doc, docx, txt, ppt, or pptx)'); $DocumentField->folderName = "ListPage"; $DocumentField->getValidator()->allowedExtensions = array('pdf', 'doc', 'docx', 'txt', 'ppt', 'pptx'); $LinkField = TextField::create('Link')->setTitle('Link URL'); $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldsToTab('Root.Main', array($categorydropdown, TextField::create('Title'), OptionSetField::create('LinkType')->setTitle('')->setSource($this->dbObject('LinkType')->enumValues()), TextField::create('Link')->setTitle('Link URL')->displayIf('LinkType')->isEqualTo('Link')->andIf('LinkType')->isNotEqualTo('Resource')->end(), DisplayLogicWrapper::create($DocumentField)->displayIf('LinkType')->isEqualTo('Resource')->andIf('LinkType')->isNotEqualTo('Link')->end(), $ImageField, HTMLEditorField::create('Content'))); return $fields; }
/** * getCMSFields * Construct the FieldList used in the CMS. To provide a * smarter UI we don't use the scaffolding provided by * parent::getCMSFields. * * @return FieldList */ public function getCMSFields() { Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css'); //Create the FieldList and push the Root TabSet on to it. $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate."))))); return $fields; }
/** * getCMSFields * Construct the FieldList used in the CMS. To provide a * smarter UI we don't use the scaffolding provided by * parent::getCMSFields. * * @return FieldList */ public function getCMSFields() { Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css'); //Create the FieldList and push the Root TabSet on to it. $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : "")))); return $fields; }
/** * getCMSFields * Construct the FieldList used in the CMS. To provide a * smarter UI we don't use the scaffolding provided by * parent::getCMSFields. * * @return FieldList */ public function getCMSFields() { Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css'); //Create the FieldList and push the Root TabSet on to it. $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Currency"), CompositeField::create(DropdownField::create("Enabled", "Enable Currency?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 ? "DISABLED: You can not disable the default currency." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 ? true : false), TextField::create("Title", "Currency Name")->setRightTitle("i.e. Great British Pound."), TextField::create("Code", "Currency Code")->setRightTitle("i.e. GBP, USD, EUR."), TextField::create("ExchangeRate", "Exchange Rate")->setRightTitle("i.e. Your new currency is USD, a conversion rate of 1.53 may apply against the local currency."), TextField::create("Symbol", "Currency Symbol")->setRightTitle("i.e. £, \$, €."), DropdownField::create("SymbolLocation", "Symbol Location", array("1" => "On the left, i.e. \$1.00", "2" => "On the right, i.e. 1.00\$", "3" => "Display the currency code instead, i.e. 1 USD."))->setRightTitle("Where should the currency symbol be placed?"), TextField::create("DecimalSeperator", "Decimal Separator")->setRightTitle("What decimal separator does this currency use?"), TextField::create("ThousandsSeparator", "Thousands Separator")->setRightTitle("What thousands separator does this currency use?"), NumericField::create("DecimalPlaces", "Decimal Places")->setRightTitle("How many decimal places does this currency use?"))))); return $fields; }
function getCMSFields() { $fields = FieldList::create(TabSet::create(Root)); $fields->addFieldToTab("Root.Main", TextField::create('Name', 'Series Name')); // $fields->addFieldToTab("Root.Main", UploadField::create('Icon', 'Series Icon')); return $fields; }
public function getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), HTMLEditorField::create('Description'), $upload = UploadField::create('DownloadFile', 'Download File'))); $upload->setFolderName('downloads'); return $fields; }
/** * Get the fields that are sent to the CMS. In * your extensions: updateCMSFields($fields) * * @return FieldList */ public function getCMSFields() { /** @var FieldList $fields */ $fields = FieldList::create(TabSet::create('Root', Tab::create('Main'), Tab::create('Settings'))); $fields->addFieldToTab('Root.Settings', TextField::create('GoogleFontAPI')); $this->extend('updateCMSFields', $fields); return $fields; }
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 getCMSFields() { $fields = FieldList::create(TabSet::create('Root')); $fields->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $fields->addFieldToTab('Root.Main', new TextField('Lat', 'Lat')); $fields->addFieldToTab('Root.Main', new TextField('Long', 'Long')); return $fields; }
public function getEditForm($id = null, $fields = null) { // TODO Duplicate record fetching (see parent implementation) if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); // TODO Duplicate record fetching (see parent implementation) $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldExportButton()))->addExtraClass("members_grid"); $memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator()); $groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create()); $columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns'); $columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title'))); $fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the database'))), new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" border="0"></iframe>', $this->Link('memberimport')))), $groupsTab = new Tab('Groups', singleton('Group')->plural_name(), $groupList, new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" border="0"></iframe>', $this->Link('groupimport'))))), new HiddenField('ID', false, 0)); $root->setTemplate('CMSTabSet'); // Add roles editing interface if (Permission::check('APPLY_ROLES')) { $rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create()); $rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles')); $rolesTab->push($rolesField); } $actionParam = $this->request->param('Action'); if ($actionParam == 'groups') { $groupsTab->addExtraClass('ui-state-selected'); } elseif ($actionParam == 'users') { $usersTab->addExtraClass('ui-state-selected'); } elseif ($actionParam == 'roles') { $rolesTab->addExtraClass('ui-state-selected'); } $actions = new FieldList(); $form = new Form($this, 'EditForm', $fields, $actions); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); } $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); $form->setAttribute('data-pjax-fragment', 'CurrentForm'); $this->extend('updateEditForm', $form); return $form; }
public function getCMSFields() { $fields = FieldList::create(); $fields->push(TabSet::create('Root', $mainTab = new Tab('Main'))); $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main")); $fields->addFieldsToTab('Root.Main', array(TextField::create('Title', _t('Block.TITLE', 'Title')))); $this->extend('updateCMSFields', $fields); return $fields; }