function updateCMSFields(FieldList $fields) { $this->SetDefaultExlcuded(); $ExludedPagesField = new TreeMultiselectField("AllInOneExludedPages", "Exluded Pages", "SiteTree"); $ExludedPagesField->setDescription("Add any pages here you want to exclude from the allinone page view"); $fields->addFieldToTab('Root.AllInOne', $ExludedPagesField); return $fields; }
/** * */ public function getCMSFields() { $fields = parent::getCMSFields(); // categories $treedropdown = new TreeMultiselectField('Categories', 'Categories to show and search for', 'TaxonomyTerm'); $treedropdown->setDescription('Displays FAQs with selected categories filtered. ' . 'Don\'t select any if you want to show all FAQs regardless of categories'); $treedropdown->setTreeBaseID(FAQ::getRootCategory()->ID); $fields->addFieldToTab('Root.Main', $treedropdown, 'Content'); $settings = new Tab('Settings', 'FAQ Settings'); $fields->insertBefore($settings, 'PublishingSchedule'); $fields->addFieldsToTab('Root.Settings', array(TextField::create('SinglePageLimit')->setDescription(' If set higher than 0, limits results to that many and removes pagination. '), TextField::create('CategoriesSelectAllText')->setDescription('Text to appear in on the "empty" first option in the categories selector'), TextField::create('SearchFieldPlaceholder')->setDescription('Text to appear in the search field before the user enters their question'), TextField::create('SearchFieldPlaceholder')->setDescription('Text to appear in the search field before the user enters their question'), TextField::create('SearchButtonText')->setDescription('Text for the search button'), TextField::create('SearchResultsTitle')->setDescription('Title for the FAQ search results'), TextareaField::create('NoResultsMessage')->setDescription('Text to appear when no search results are found'), TextareaField::create('SearchNotAvailable')->setDescription('Text to appear when search functionality is not available'), TextField::create('MoreLinkText')->setDescription('Text for the "Read more" link below each search result'), TextareaField::create('SearchResultsSummary')->setDescription(' Search summary string. Replacement keys: <ul> <li> <strong>%CurrentPage%</strong>: Current page number </li> <li> <strong>%TotalPages%</strong>: Total page count </li> <li> <strong>%Query%</strong>: Current search query </li> </ul> '))); // Featured FAQs tab $FeaturedFAQsTab = new Tab('FeaturedFAQs', _t('FAQPage.FeaturedFAQs', 'Featured FAQs')); $fields->insertBefore($FeaturedFAQsTab, 'PublishingSchedule'); $components = GridFieldConfig_RelationEditor::create(); $components->removeComponentsByType('GridFieldAddNewButton'); $components->removeComponentsByType('GridFieldEditButton'); $components->removeComponentsByType('GridFieldFilterHeader'); $components->addComponent(new GridFieldSortableRows('SortOrder')); $dataColumns = $components->getComponentByType('GridFieldDataColumns'); $dataColumns->setDisplayFields(array('Title' => _t('FAQPage.ColumnQuestion', 'Ref.'), 'Question' => _t('FAQPage.ColumnQuestion', 'Question'), 'Answer.Summary' => _t('FAQPage.ColumnPageType', 'Answer'), 'Category.Name' => _t('FAQPage.ColumnPageType', 'Category'))); $components->getComponentByType('GridFieldAddExistingAutocompleter')->setResultsFormat('$Question'); // warning for categories filtering on featured FAQs $differentCategories = 0; if ($this->Categories()->count() > 0) { $FAQsWithCategories = $this->FeaturedFAQs()->filter('CategoryID', $this->Categories()->column('ID'))->count(); $totalFeaturedFAQs = $this->FeaturedFAQs()->count(); $differentCategories = $totalFeaturedFAQs - $FAQsWithCategories; } $FeaturedFAQsCategoryNotice = '<p class="message %s">Only featured FAQs with selected categories will ' . 'be displayed on the site. If you have not selected a category, all of the ' . 'featured FAQs will be displayed.</p>'; if ($differentCategories) { $FeaturedFAQsCategoryNotice = sprintf('<p class="message %s">You have %d FAQs with different categories than the ones you have selected ' . 'to show on this FAQPage. These will not be displayed.</p>', $differentCategories ? 'bad' : '', $differentCategories); } $fields->addFieldsToTab('Root.FeaturedFAQs', array(LiteralField::create('FeaturedFAQsCategoryNotice', $FeaturedFAQsCategoryNotice), GridField::create('FeaturedFAQs', _t('FAQPage.FeaturedFAQs', 'Featured FAQs'), $this->FeaturedFAQs(), $components))); return $fields; }
public function getSettingsFields() { $fields = parent::getSettingsFields(); $fields->addFieldToTab('Root', new Tab('Profile'), 'Settings'); $fields->addFieldsToTab('Root.Profile', array(new CheckboxField('AllowRegistration', _t('MemberProfiles.ALLOWREG', 'Allow registration via this page')), new CheckboxField('AllowProfileEditing', _t('MemberProfiles.ALLOWEDITING', 'Allow users to edit their own profile on this page')), new CheckboxField('AllowAdding', _t('MemberProfiles.ALLOWADD', 'Allow adding members via this page')), new CheckboxField('AllowProfileViewing', _t('MemberProfiles.ALLOWPROFILEVIEWING', 'Enable public profiles?')), new CheckboxField('RequireApproval', _t('MemberProfiles.REQUIREREGAPPROVAL', 'Require registration approval by an administrator?')), $approval = new TreeMultiselectField('ApprovalGroups', _t('MemberProfiles.APPROVALGROUPS', 'Approval Groups'), 'Group'), new CheckboxField('RegistrationRedirect', _t('MemberProfiles.REDIRECTAFTERREG', 'Redirect after registration?')), new TreeDropdownField('PostRegistrationTargetID', _t('MemberProfiles.REDIRECTTOPAGE', 'Redirect To Page'), 'SiteTree'))); $approval->setDescription(_t('MemberProfiles.NOTIFYTHESEGROUPS', 'These groups will be notified to approve new registrations')); return $fields; }