本文整理汇总了PHP中GridFieldConfig_RecordEditor类的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig_RecordEditor类的具体用法?PHP GridFieldConfig_RecordEditor怎么用?PHP GridFieldConfig_RecordEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GridFieldConfig_RecordEditor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
foreach (['primary', 'secondary'] as $lower) {
$upper = ucfirst($lower);
$config = $this->owner->config()->get("{$lower}_gallery");
if (is_null($config) || isset($config['enabled']) && $config['enabled'] === false) {
continue;
}
$config['title'] = isset($config['title']) ? $config['title'] : "{$upper} Gallery";
$config['folder'] = isset($config['folder']) ? $config['folder'] : "{$upper}-Gallery-Images";
$GridFieldConfig = new GridFieldConfig_RecordEditor();
$GridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
$GridFieldConfig->addComponent($bulkUploadConfig = new GridFieldBulkUpload());
$GridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
$GridFieldConfig->addComponent(new GridFieldGalleryTheme('Image'));
$bulkUploadConfig->setUfSetup('setFolderName', "Images/{$config['folder']}");
$GridField = new GridField("{$upper}GalleryGridField", $config['title'], $this->owner->{"{$upper}GalleryImages"}(), $GridFieldConfig);
/** @var TabSet $rootTab */
//We need to repush Metadata to ensure it is the last tab
$rootTab = $fields->fieldByName('Root');
$rootTab->push($tab = Tab::create("{$upper}Gallery"));
if ($rootTab->fieldByName('Metadata')) {
$metaChildren = $rootTab->fieldByName('Metadata')->getChildren();
$rootTab->removeByName('Metadata');
$rootTab->push(Tab::create('Metadata')->setChildren($metaChildren));
}
$tab->setTitle($config['title']);
$fields->addFieldToTab("Root.{$upper}Gallery", $GridField);
}
}
开发者ID:helpfulrobot,项目名称:webfox-silverstripe-gallery,代码行数:30,代码来源:GalleryExtension.php
示例2: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>OpenStack Component</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new TextField("CodeName", "Code Name"));
$fields->push(new TextField("Description", "Description"));
$fields->push(new CheckboxField('SupportsVersioning', 'Supports Versioning?'));
$fields->push(new CheckboxField('SupportsExtensions', 'Supports Extensions?'));
$fields->push(new CheckboxField('IsCoreService', 'Is Core Service?'));
$fields->push(new DropdownField('IconClass', 'Font Awesome Icon CSS Class', $this->owner->dbObject('IconClass')->enumValues()));
$fields->push(new DropdownField('Use', 'OpenStack Usage', $this->owner->dbObject('Use')->enumValues()));
if ($this->owner->getSupportsVersioning()) {
$versions_config = new GridFieldConfig_RecordEditor();
$versions = new GridField("Versions", "Versions", $this->owner->Versions(), $versions_config);
$fields->push($versions);
}
$config = new GridFieldConfig_RecordEditor();
$config->addComponent(new GridFieldSortableRows('Order'));
$related_content = new GridField("RelatedContent", "RelatedContent", $this->owner->RelatedContent(), $config);
$fields->push($related_content);
return $fields;
}
开发者ID:rbowen,项目名称:openstack-org,代码行数:30,代码来源:OpenStackComponentAdminUI.php
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$badge = new UploadField('Badge', _t('ScoutGroup.BADGE', 'Badge'));
$badge->setFolderName('group/badge');
$badge->setRightTitle(_t('ScoutGroup.BADGE_HELP', 'The badge/logo/emblem of the Group'))->addExtraClass('help');
$fields->addFieldToTab('Root.Info', $badge);
$necker = new UploadField('Necker', _t('ScoutGroup.NECKER', 'Necker'));
$necker->setFolderName('group/necker');
$necker->setRightTitle(_t('ScoutGroup.NECKER_HELP', 'The neckerchief the Group'))->addExtraClass('help');
$fields->addFieldToTab('Root.Info', $necker);
$fields->addFieldToTab('Root.Info', new TextField('NeckerDescription', _t('ScoutGroup.NECKERDESCRIPTION', 'Neckerchief Description')));
$fields->addFieldToTab('Root.Social', new TextField('TwitterUser', _t('ScoutGroup.TWITTERUSER', 'Twitter User')));
$fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('ScoutGroup.FACEBOOKPAGE', 'Facebook Page')));
$fields->addFieldToTab('Root.Social', new TextField('GooglePage', _t('ScoutGroup.GOOGLEPAGE', 'Google Page')));
$fields->addFieldToTab('Root.Contact', new TextField('Address1', _t('ScoutGroup.ADDRESS1', 'Address 1')));
$fields->addFieldToTab('Root.Contact', new TextField('Address2', _t('ScoutGroup.ADDRESS2', 'Address 2')));
$fields->addFieldToTab('Root.Contact', new TextField('Address3', _t('ScoutGroup.ADDRESS3', 'Address 3')));
$fields->addFieldToTab('Root.Contact', new TextField('Town', _t('ScoutGroup.TOWN', 'Town')));
$fields->addFieldToTab('Root.Contact', new TextField('Postcode', _t('ScoutGroup.POSTCODE', 'Post Code')));
$fields->addFieldToTab('Root.Contact', new TextField('Phone', _t('ScoutGroup.PHONE', 'Phone #')));
$fields->addFieldToTab('Root.Contact', new TextField('Email', _t('ScoutGroup.EMAIL', 'Email Address')));
$fields->addFieldToTab('Root.Contact', new TextField('CharityNumber', _t('ScoutGroup.CHARITYNUMBER', 'CharityNumber')));
$sectionGridConfig = new GridFieldConfig_RecordEditor();
$sectionGridConfig->addComponent(new GridFieldSortableRows('SortOrder'));
$sectionGrid = new GridField('Sections', 'Sections', $this->Sections(), $sectionGridConfig);
$fields->addFieldToTab('Root.Sections', $sectionGrid);
$this->extend('updateCMSFields', $fields);
return $fields;
}
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:30,代码来源:ScoutGroup.php
示例4: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new TextField("Title", "Title"));
$fields->push(new HtmlEditorField("Summary", "Summary"));
$fields->push(new HtmlEditorField("Description", "Description"));
$fields->push(new MemberAutoCompleteField("Curator", "Curator"));
$fields->push($ddl = new DropdownField('ReleaseID', 'Release', OpenStackRelease::get()->map("ID", "Name")));
$ddl->setEmptyString('-- Select a Release --');
if ($this->owner->ID > 0) {
$components_config = new GridFieldConfig_RelationEditor(100);
$components = new GridField("OpenStackComponents", "Supported Release Components", $this->owner->OpenStackComponents(), $components_config);
$components_config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchList($this->getAllowedComponents());
$components_config->removeComponentsByType('GridFieldAddNewButton');
//$components_config->addComponent(new GridFieldSortableRows('OpenStackSampleConfig_OpenStackComponents.Order'));
$fields->push($components);
$fields->push($ddl = new DropdownField('TypeID', 'Type', OpenStackSampleConfigurationType::get()->filter('ReleaseID', $this->owner->ReleaseID)->map("ID", "Type")));
$ddl->setEmptyString('-- Select a Configuration Type --');
$related_notes_config = new GridFieldConfig_RecordEditor(100);
$related_notes = new GridField("RelatedNotes", "Related Notes", $this->owner->RelatedNotes(), $related_notes_config);
$related_notes_config->addComponent(new GridFieldSortableRows('Order'));
$fields->push($related_notes);
}
return $fields;
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:32,代码来源:OpenStackSampleConfigAdminUI.php
示例5: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$items = $this->owner->FeaturedItems();
$gridCfg = new GridFieldConfig_RecordEditor(1000);
// we use RecordEditor instead of RelationEditor so it deletes instead of unlinks
if (class_exists('GridFieldOrderableRows') && !$items instanceof UnsavedRelationList) {
$gridCfg->addComponent(new GridFieldOrderableRows('Sort'));
}
$grid = new GridField('FeaturedItems', 'Featured Items', $items, $gridCfg);
$fields->addFieldToTab('Root.FeaturedItems', $grid);
}
开发者ID:markguinn,项目名称:silverstripe-featureditems,代码行数:14,代码来源:HasFeaturedItems.php
示例6: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(new Tab('GetInvolved'), 'Settings');
$fields->insertBefore(new Tab('Events'), 'Settings');
$fields->insertBefore(new Tab('Collateral'), 'Settings');
$fields->insertBefore(new Tab('Software'), 'Settings');
$fields->insertBefore(new Tab('Graphics'), 'Settings');
$fields->insertBefore(new Tab('Promote'), 'Settings');
// header
$fields->removeByName('Content');
$fields->addFieldToTab('Root.Main', new TextField('HeaderTitle', 'Header Title'));
$fields->addFieldToTab('Root.Main', new HtmlEditorField('HeaderText', 'Header Text'));
// Get Involved
$fields->addFieldToTab('Root.GetInvolved', $involved_images = new UploadField('InvolvedImages', 'Involved Images'));
$involved_images->setFolderName('marketing');
$fields->addFieldToTab('Root.GetInvolved', new HtmlEditorField('InvolvedText', 'Involved Text', $this->InvolvedText));
// Events
$fields->addFieldToTab('Root.Events', new HtmlEditorField('EventsIntroText', 'Events Intro Text', $this->EventsIntroText));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Events', new GridField('SponsorEvents', 'SponsorEvents', $this->SponsorEvents(), $config));
// Collateral
$fields->addFieldToTab('Root.Collateral', new HtmlEditorField('CollateralIntroText', 'Collateral Intro Text', $this->CollateralIntroText));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Collateral', new GridField('Collaterals', 'Collaterals', $this->Collaterals(), $config));
// Software
$fields->addFieldToTab('Root.Software', new HtmlEditorField('SoftwareIntroText', 'Software Intro Text', $this->SoftwareIntroText));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Software', new GridField('Software', 'Software', $this->Software(), $config));
// Graphics
$fields->addFieldToTab('Root.Graphics', new HtmlEditorField('GraphicsIntroText', 'Graphics Intro Text', $this->GraphicsIntroText));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Graphics', new GridField('Stickers', 'Stickers', $this->Stickers(), $config));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Graphics', new GridField('TShirts', 'TShirts', $this->TShirts(), $config));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Graphics', new GridField('Banners', 'Banners', $this->Banners(), $config));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Graphics', new GridField('Videos', 'Videos', $this->Videos(), $config));
// Promote
$fields->addFieldToTab('Root.Promote', $about_desc = new HtmlEditorField('PromoteProductIntroText', 'Promote Intro Text', $this->PromoteProductIntroText));
$config = new GridFieldConfig_RecordEditor(3);
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$fields->addFieldToTab('Root.Promote', new GridField('PromoteEvents', 'PromoteEvents', $this->PromoteEvents(), $config));
return $fields;
}
开发者ID:hogepodge,项目名称:openstack-org,代码行数:53,代码来源:MarketingPage.php
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Content');
$fields->addFieldsToTab('Root.Main', new TextField('IntroTitle', 'Intro Title'));
$fields->addFieldsToTab('Root.Main', new HtmlEditorField('IntroText', 'Intro Text'));
$fields->addFieldsToTab('Root.Main', new TextField('IntroTitle2', 'Intro Title 2'));
$fields->addFieldsToTab('Root.Main', new HtmlEditorField('IntroText2', 'Intro Text 2'));
$config = new GridFieldConfig_RecordEditor(100);
$sub_menu = new GridField("SubMenuPages", "SubMenu Pages", $this->SubMenuPages(), $config);
$config->addComponent(new GridFieldSortableRows('Order'));
$fields->push($sub_menu);
return $fields;
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:14,代码来源:SoftwareHomePage.php
示例8: addCategoriesTab
private function addCategoriesTab($fields)
{
$config = GridFieldConfig_RecordEditor::create();
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$categoriesField = new GridField('Categories', 'Categories', $this->Categories(), $config);
$fields->addFieldToTab('Root.Categories', $categoriesField);
}
开发者ID:helpfulrobot,项目名称:plumpss-news,代码行数:7,代码来源:ArticleHolder.php
示例9: getEditForm
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;
}
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:60,代码来源:SecurityAdmin.php
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.SuccessContent", array(TextField::create("Currency"), TextField::create("SuccessTitle"), HTMLEditorField::create("SuccessContent")));
$fields->addFieldToTab("Root.Invoices", GridField::create("Invoices", "Invoices", $this->Invoices(), GridFieldConfig_RecordEditor::create()));
return $fields;
}
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-payme,代码行数:7,代码来源:PayMePage.php
示例11: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('IndustryName' => 'IndustryName', 'Active' => 'Active'));
$industries = new GridField('UserStoriesIndustry', 'User Stories Industry', UserStoriesIndustry::get(), $config);
$fields->addFieldsToTab('Root.Industries', $industries);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('UserStory.Title' => 'UserStory', 'UserStoriesIndustry.IndustryName' => 'Industry'));
$Featured = new GridField('UserStoriesFeatured', 'User Stories Featured', UserStoriesFeatured::get(), $config);
$fields->addFieldsToTab('Root.FeaturedStories', $Featured);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('LinkName' => 'LinkName', 'UserStory.Title' => 'UserStory'));
$links = new GridField('UserStoriesLink', 'User Stories Link', UserStoriesLink::get(), $config);
$fields->addFieldsToTab('Root.Links', $links);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Topic' => 'Topic'));
$topics = new GridField('UserStoriesTopics', 'User Stories Topics', UserStoriesTopics::get(), $config);
$fields->addFieldsToTab('Root.Topics', $topics);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('UserStoriesTopics.Topic' => 'Topic', 'LabelTitle' => 'Title'));
$TopicsFeatured = new GridField('UserStoriesTopicsFeatured', 'User Stories Topics Featured', UserStoriesTopicsFeatured::get(), $config);
$fields->addFieldsToTab('Root.FeaturedOnSlider', $TopicsFeatured);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Type' => 'Type', 'Content' => 'Content'));
$slides = new GridField('UserStoriesSlides', 'User Stories Slides', UserStoriesSlides::get(), $config);
$fields->addFieldsToTab('Root.Slides', $slides);
return $fields;
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:29,代码来源:UserStoryHolder.php
示例12: getCMSFields
/**
* 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;
}
开发者ID:nzjoel,项目名称:silverstripe-userforms,代码行数:30,代码来源:UserDefinedForm.php
示例13: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldsToTab("Root.Banners", GridField::create("Banners", null, $this->owner->Banners(), $config = GridFieldConfig_RecordEditor::create()));
if (class_exists("GridFieldOrderableRows")) {
$config->addComponent(new GridFieldOrderableRows());
}
}
开发者ID:burnbright,项目名称:silverstripe-banner,代码行数:7,代码来源:BannersExtension.php
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(TextareaField::create('Intro', 'Intro'), 'Content');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Intro");
$fields->insertBefore($image = UploadField::create('SplashImage', 'Splash Image'), 'Content');
$image->setFolderName('Uploads/Splash-Images');
if ($this->ClassName === "Page" || $this->ClassName === "HomePage") {
$fields->insertAfter(HTMLEditorField::create('ExtraContent'), 'Content');
$gridField = new GridField('FeatureItems', 'FeatureItems', $this->FeatureItems()->sort(array('Sort' => 'ASC', 'Archived' => 'ASC')), $config = GridFieldConfig_RelationEditor::create());
$gridField->setModelClass('FeatureItem');
$fields->addFieldToTab('Root.Features', $gridField);
$config->addComponent(new GridFieldOrderableRows());
} else {
if ($this->ClassName === "CalendarPage") {
$content = $fields->dataFieldByName('Content');
$content->addExtraClass('no-pagebreak');
$events = Event::get()->sort(array('StartDateTime' => 'Desc'))->filterByCallback(function ($record) {
return !$record->getIsPastEvent();
});
$gridField = new GridField('Event', 'Upcoming Events', $events, $config = GridFieldConfig_RecordEditor::create());
$gridField->setModelClass('Event');
$dataColumns = $config->getComponentByType('GridFieldDataColumns');
$dataColumns->setDisplayFields(array('Title' => 'Title', 'StartDateTime' => 'Date and Time', 'DatesAndTimeframe' => 'Presentation String'));
$fields->addFieldToTab('Root.UpcomingEvents', $gridField);
}
}
return $fields;
}
开发者ID:adrexia,项目名称:nzlarps,代码行数:29,代码来源:Page.php
示例15: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// Create a default configuration for the new GridField, allowing record deletion
$config = GridFieldConfig_RecordEditor::create();
// Set the names and data for our gridfield columns
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'StartTime' => 'Start Time', 'EndTime' => 'End Time'));
// Create a gridfield to hold the calendar event relationship
$calendarEventsGridField = new GridField('CalendarEvents', 'Calendar Events', $this->CalendarEvents(), $config);
// Create a tab named "Calendar" and add our field to it
$fields->addFieldToTab('Root.Calendar', $calendarEventsGridField);
// Create a default configuration for the location GridField, allowing record deletion
$locationsConfig = GridFieldConfig::create();
$locationsConfig->addComponent(new GridFieldButtonRow('before'));
$locationsConfig->addComponent(new GridFieldToolbarHeader());
$locationsConfig->addComponent(new GridFieldTitleHeader());
$locationsConfig->addComponent(new GridFieldEditableColumns());
$locationsConfig->addComponent(new GridFieldDeleteAction());
$locationsConfig->addComponent(new GridFieldAddNewInlineButton());
// Create a gridfield to hold the locations
$locationsGridField = new GridField('CalendarLocations', 'Calendar Locations', $this->CalendarLocations(), $locationsConfig);
// Create a tab named "Locations" and add our field to it
$fields->addFieldToTab('Root.Locations', $locationsGridField);
return $fields;
}
开发者ID:pmachapman,项目名称:rcpn.org.nz,代码行数:25,代码来源:CalendarPage.php
示例16: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Main', 'Content', true);
$fields->addFieldsToTab('Root.Fields', array(new GridField('Fields', _t('MemberProfiles.PROFILEFIELDS', 'Account Fields'), $this->Fields(), $grid = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldAddNewButton'))));
return $fields;
}
开发者ID:helpfulrobot,项目名称:zucchi-membermanagement,代码行数:7,代码来源:MembersAccountPage.php
示例17: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
$f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
$f->addFieldToTab('Root.Main', new TextField('Name', 'Name'));
$f->addFieldToTab('Root.Main', $ddl = new DropdownField('ListType', 'ListType', $this->dbObject('ListType')->enumValues()));
$f->addFieldToTab('Root.Main', $ddl2 = new DropdownField('CategoryID', 'Category', PresentationCategory::get()->filter('SummitID', $_REQUEST['SummitID'])->map('ID', 'Title')));
$ddl->setEmptyString('-- Select List Type --');
$ddl2->setEmptyString('-- Select Track --');
if ($this->ID > 0) {
$config = GridFieldConfig_RecordEditor::create(25);
$config->addComponent(new GridFieldAjaxRefresh(1000, false));
$config->addComponent(new GridFieldPublishSummitEventAction());
$config->removeComponentsByType('GridFieldDeleteAction');
$config->removeComponentsByType('GridFieldAddNewButton');
$config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents());
$bulk_summit_types->setTitle('Set Summit Types');
$result = DB::query("SELECT DISTINCT SummitEvent.*, Presentation.*\nFROM SummitEvent\nINNER JOIN Presentation ON Presentation.ID = SummitEvent.ID\nINNER JOIN SummitSelectedPresentation ON SummitSelectedPresentation.PresentationID = Presentation.ID\nINNER JOIN SummitSelectedPresentationList ON SummitSelectedPresentation.SummitSelectedPresentationListID = {$this->ID}\nORDER BY SummitSelectedPresentation.Order ASC\n");
$presentations = new ArrayList();
foreach ($result as $row) {
$presentations->add(new Presentation($row));
}
$gridField = new GridField('SummitSelectedPresentations', 'Selected Presentations', $presentations, $config);
$gridField->setModelClass('Presentation');
$f->addFieldToTab('Root.Main', $gridField);
}
return $f;
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:30,代码来源:SummitSelectedPresentationList.php
示例18: getModularCMSFields
function getModularCMSFields($relationName = 'Modules', $title = 'Content Modules')
{
$fields = array();
$GLOBALS['_CONTENT_MODULE_PARENT_PAGEID'] = $this->owner->ID;
$area = $this->owner->obj($relationName);
if ($area && $area->exists()) {
$fields[] = HeaderField::create($relationName . 'Header', $title, 2);
$fields[] = GridField::create($relationName, $title, $area->Modules(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldOrderableRows('SortOrder'))->removeComponentsByType('GridFieldAddNewButton')->addComponent($add = new GridFieldAddNewMultiClass()));
if (($allowed_modules = $this->owner->Config()->get('allowed_modules')) && is_array($allowed_modules) && count($allowed_modules)) {
if (isset($allowed_modules[$relationName])) {
$add->setClasses($allowed_modules[$relationName]);
} else {
$add->setClasses($allowed_modules);
}
} else {
// Remove the base "ContentModule" from allowed modules.
$classes = array_values(ClassInfo::subclassesFor('ContentModule'));
sort($classes);
if (($key = array_search('ContentModule', $classes)) !== false) {
unset($classes[$key]);
}
$add->setClasses($classes);
}
} else {
$fields[] = LiteralField::create('SaveFirstToAddModules', '<div class="message">You must save first before you can add modules.</div>');
}
return $fields;
}
开发者ID:christopherbolt,项目名称:silverstripe-contentmodules,代码行数:28,代码来源:ModularPageExtension.php
示例19: getCMSFields
public function getCMSFields()
{
$self = $this;
$this->beforeUpdateCMSFields(function ($f) use($self) {
Requirements::javascript('event_calendar/javascript/calendar_cms.js');
$f->addFieldToTab("Root.Main", TextField::create("Location", _t('Calendar.LOCATIONDESCRIPTION', 'The location for this event')), 'Content');
$dt = _t('CalendarEvent.DATESANDTIMES', 'Dates and Times');
$recursion = _t('CalendarEvent.RECURSION', 'Recursion');
$f->addFieldToTab("Root.{$dt}", GridField::create("DateTimes", _t('Calendar.DATETIMEDESCRIPTION', 'Add dates for this event'), $self->DateTimes(), GridFieldConfig_RecordEditor::create()));
$f->addFieldsToTab("Root.{$recursion}", array(new CheckboxField('Recursion', _t('CalendarEvent.REPEATEVENT', 'Repeat this event')), new OptionsetField('CustomRecursionType', _t('CalendarEvent.DESCRIBEINTERVAL', 'Describe the interval at which this event recurs.'), array('1' => _t('CalendarEvent.DAILY', 'Daily'), '2' => _t('CalendarEvent.WEEKLY', 'Weekly'), '3' => _t('CalendarEvent.MONTHLY', 'Monthly')))));
$f->addFieldToTab("Root.{$recursion}", $dailyInterval = new FieldGroup(new LabelField($name = "every1", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('DailyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "days", $title = _t("CalendarEvent.DAYS", " day(s)"))));
$f->addFieldToTab("Root.{$recursion}", $weeklyInterval = new FieldGroup(new LabelField($name = "every2", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('WeeklyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "weeks", $title = _t("CalendarEvent.WEEKS", " weeks"))));
$f->addFieldToTab("Root.{$recursion}", new CheckboxSetField('RecurringDaysOfWeek', _t('CalendarEvent.ONFOLLOWINGDAYS', 'On the following day(s)...'), DataList::create("RecurringDayOfWeek")->map("ID", "Title")));
$f->addFieldToTab("Root.{$recursion}", $monthlyInterval = new FieldGroup(new LabelField($name = "every3", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('MonthlyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "months", $title = _t("CalendarEvent.MONTHS", " month(s)"))));
$f->addFieldsToTab("Root.{$recursion}", array(new OptionsetField('MonthlyRecursionType1', '', array('1' => _t('CalendarEvent.ONTHESEDATES', 'On these date(s)...'))), new CheckboxSetField('RecurringDaysOfMonth', '', DataList::create("RecurringDayOfMonth")->map("ID", "Value")), new OptionsetField('MonthlyRecursionType2', '', array('1' => _t('CalendarEvent.ONTHE', 'On the...')))));
$f->addFieldToTab("Root.{$recursion}", $monthlyIndex = new FieldGroup(new DropdownField('MonthlyIndex', '', array('1' => _t('CalendarEvent.FIRST', 'First'), '2' => _t('CalendarEvent.SECOND', 'Second'), '3' => _t('CalendarEvent.THIRD', 'Third'), '4' => _t('CalendarEvent.FOURTH', 'Fourth'), '5' => _t('CalendarEvent.LAST', 'Last'))), new DropdownField('MonthlyDayOfWeek', '', DataList::create("RecurringDayOfWeek")->map("Value", "Title")), new LabelField($name = "ofthemonth", $title = _t("CalendarEvent.OFTHEMONTH", " of the month."))));
$f->addFieldToTab("Root.{$recursion}", GridField::create("Exceptions", _t('CalendarEvent.ANYEXCEPTIONS', 'Any exceptions to this pattern? Add the dates below.'), $self->Exceptions(), GridFieldConfig_RecordEditor::create()));
$dailyInterval->addExtraClass('dailyinterval');
$weeklyInterval->addExtraClass('weeklyinterval');
$monthlyInterval->addExtraClass('monthlyinterval');
$monthlyIndex->addExtraClass('monthlyindex');
});
$f = parent::getCMSFields();
return $f;
}
开发者ID:helpfulrobot,项目名称:unclecheese-eventcalendar,代码行数:25,代码来源:CalendarEvent.php
示例20: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Features');
$fields->removeByName('ExtraContent');
$regContent = $fields->dataFieldByName('RegistrationContent');
$afterContent = $fields->dataFieldByName('AfterRegistrationContent');
$profileContent = $fields->dataFieldByName('ProfileCon
|
请发表评论