本文整理汇总了PHP中GridFieldConfig_RelationEditor类的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig_RelationEditor类的具体用法?PHP GridFieldConfig_RelationEditor怎么用?PHP GridFieldConfig_RelationEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GridFieldConfig_RelationEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getCMSFields
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;
}
示例3: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$cfg = new GridFieldConfig_RelationEditor(100);
if (class_exists('GridFieldOrderableRows')) {
$cfg->addComponent(new GridFieldOrderableRows('Sort'));
}
$grid = new GridField('Videos', 'Videos', $this->owner->Videos(), $cfg);
$fields->addFieldToTab('Root.Videos', $grid);
}
示例4: updateCMSFields
/**
* @return FieldList
*/
public function updateCMSFields(FieldList $fields)
{
$slidesConfig = new GridFieldConfig_RelationEditor();
if (class_exists('GridFieldSortableRows')) {
$slidesConfig->addComponent(new GridFieldSortableRows('Sort'));
}
$slidesGrid = GridField::create('HomeSlides', 'HomeSlides', $this->owner->HomeSlides(), $slidesConfig);
$fields->addFieldToTab('Root.Slides', $slidesGrid);
return $fields;
}
开发者ID:helpfulrobot,项目名称:plato-creative-plato-silverstripe-homeslides,代码行数:13,代码来源:HomePageExtension.php
示例5: getCMSFields
/**
* @return \FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Countries');
if ($this->exists()) {
$fields->addFieldToTab('Root.Countries', new \GridField('Countries', 'Countries in zone', $this->Countries(), $config = new \GridFieldConfig_RelationEditor()));
$config->removeComponentsByType("GridFieldAddNewButton");
$config->removeComponentsByType("GridFieldEditButton");
//GridFieldConfig_RelationEditor
}
return $fields;
}
示例6: updateCMSFields
/**
* @return FieldList
*/
public function updateCMSFields(FieldList $fields)
{
$tilesConfig = new GridFieldConfig_RelationEditor();
if (class_exists('GridFieldSortableRows')) {
$tilesConfig->addComponent(new GridFieldSortableRows('Sort'));
}
if ($this->owner->HomeTiles()->Count() == $this->owner->config()->HomeTilesLimit) {
$tilesConfig->removeComponentsByType('GridFieldAddNewButton');
}
$slidesGrid = GridField::create('HomeTiles', 'HomeTiles', $this->owner->HomeTiles(), $tilesConfig);
$fields->addFieldToTab('Root.Tiles', $slidesGrid);
return $fields;
}
开发者ID:helpfulrobot,项目名称:plato-creative-plato-silverstripe-hometiles,代码行数:16,代码来源:HomePageTilesExtension.php
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// variables
// $config = SiteConfig::current_site_config();
$owner = $this->owner;
//// Authorship
$tab = 'Root.SEO.Authorship';
//
$authorsConfig = new GridFieldConfig_RelationEditor();
$authorsConfig->removeComponentsByType('GridFieldAddNewButton');
//
$fields->addFieldsToTab($tab, array(GridField::create('Authors', 'Authors', $owner->Authors(), $authorsConfig)));
}
开发者ID:Graphiques-Digitale,项目名称:silverstripe-seo-google-plus-authorship,代码行数:13,代码来源:SEO_Authorship_SiteTree_DataExtension.php
示例8: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$galleryConfig = new GridFieldConfig_RelationEditor();
if (class_exists('GridFieldSortableRows')) {
$galleryConfig->addComponent(new GridFieldSortableRows('Sort'));
}
if ($this->owner->GalleryItems()->Count() >= $this->getItemLimit()) {
$galleryConfig->removeComponentsByType('GridFieldAddNewButton');
}
$galleryGrid = GridField::create('GalleryItems', 'GalleryItems', $this->GalleryItems(), $galleryConfig);
$fields->addFieldToTab('Root.Gallery', $galleryGrid);
return $fields;
}
示例9: updateCMSFields
/**
* Setup the CMS Fields
*
* @param FieldList
*/
public function updateCMSFields(FieldList $fields)
{
if (!$this->supportsElemental()) {
return false;
}
// add an empty holder for content as some module explicitly use insert
// after content.
$fields->replaceField('Content', new LiteralField('Content', ''));
$adder = new ElementalGridFieldAddNewMultiClass();
$list = $this->getAvailableTypes();
$adder->setClasses($list);
$area = $this->owner->ElementArea();
if (!$area->exists() || !$area->isInDB()) {
$area->write();
$this->owner->ElementAreaID = $area->ID;
$this->owner->write();
}
$gridField = GridField::create('ElementArea', Config::inst()->get("ElementPageExtension", 'elements_title'), $this->owner->ElementArea()->Elements(), GridFieldConfig_RelationEditor::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldAddExistingAutocompleter')->addComponent(new ElementalGridFieldAddExistingAutocompleter())->addComponent(new ElementalGridFieldDeleteAction())->addComponent($adder)->addComponent(new GridFieldSortableRows('Sort')));
$config = $gridField->getConfig();
$paginator = $config->getComponentByType('GridFieldPaginator');
$paginator->setItemsPerPage(100);
$config->removeComponentsByType('GridFieldDetailForm');
$config->addComponent(new VersionedDataObjectDetailsForm());
$fields->addFieldToTab('Root.Main', $gridField);
return $fields;
}
示例10: updateCMSFields
function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.SkitterSlides', $grid = new GridField('MaxSkitterSlides', 'Skitter slides', $this->owner->MaxSkitterSlides(), GridFieldConfig_RelationEditor::create(10)));
if (class_exists("GridFieldSortableRows")) {
$grid->getConfig()->addComponent(new GridFieldSortableRows('SortOrder'));
}
}
示例11: getFieldsForImagesTab
/**
* Returns array of fields to be added to Gallery Images Tab
*
* @return array
*/
public function getFieldsForImagesTab()
{
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.SOURCE_HEADER', 'Choose your desired image source'));
$aFields[] = new OptionsetField("Source", _t('ResponsiveGalleryExtension.SOURCE_LABEL', 'Source'), array("sf" => _t('ResponsiveGalleryExtension.SOURCEFOLDER_LABEL', 'Source Folder'), "dl" => _t('ResponsiveGalleryExtension.DATALIST_LABEL', 'Data List')), "sf");
switch ($this->owner->Source) {
case "dl":
$oGridFieldConfig = GridFieldConfig_RelationEditor::create()->addComponents(new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldBulkUpload('GalleryImage'), new GridFieldSortableRows('SortOrder'));
$oGridFieldConfig->getComponentByType('GridFieldBulkUpload')->setUfSetup('setFolderName', $this->getUploadFolder())->setUfConfig('sequentialUploads', true);
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.DATALIST_HEADER', 'Create your image list'));
$aFields[] = LiteralField::create("DataListInfo", '<div class="field"><p>' . _t('ResponsiveGalleryExtension.DATALIST_INFO', 'You can select images from files or upload images and add them to your customized image list. ' . 'Use "Target Folder" field to select a default target folder for your image uploads.') . '</p></div>');
$aFields[] = new TreeDropdownField('UploadFolderID', _t('ResponsiveGalleryExtension.UPLOADFOLDER_LABEL', 'Target Folder'), 'Folder');
$aFields[] = new GridField("GalleryImages", _t('ResponsiveGalleryExtension.IMAGES_LABEL', 'Images'), $this->getImages(), $oGridFieldConfig);
break;
case "sf":
$iImageCount = $this->countImages();
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.SOURCEFOLDER_HEADER', 'Select source folder of gallery'));
$aFields[] = new TreeDropdownField('SourceFolderID', _t('ResponsiveGalleryExtension.SOURCEFOLDER_LABEL', 'Source Folder'), 'Folder');
if ($this->isSourcefolderSelected()) {
$aFields[] = LiteralField::create("ImageCountInfo", '<div class="field">' . '<p class="info-message">' . _t('ResponsiveGalleryExtension.IMAGECOUNTINFO', 'There are {imageCount} images in your selected folder.', 'The number of images in this gallery', array('imageCount' => $iImageCount)) . '</p></div>');
} else {
$aFields[] = LiteralField::create("NoSelectedFolderInfo", '<div class="field">' . '<p><span class="info-message">' . _t('ResponsiveGalleryExtension.NOSELECTEDFOLDER_INFO', 'Please select a folder that contains the images to be displayed in this gallery.') . '</p></div>');
}
break;
default:
$aFields[] = LiteralField::create("SelectSourceInfo", '<div class="field">' . '<p><span class="info-message">' . _t('ResponsiveGalleryExtension.SELECTSOURCEINFO_HEADER', 'Please select your desired image source type in field above.') . '</span><br/>' . _t('ResponsiveGalleryExtension.SELECTSOURCE_INFO', 'Then click on save button below, to be able to configure this gallery.') . '</p></div>');
}
return $aFields;
}
示例12: updateCMSFields
function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.MaxCarouselItems', $grid = new GridField('MaxCarouselItems', 'Carousel items', $this->owner->sortedMaxCarouselItems(), GridFieldConfig_RelationEditor::create(10)));
if (class_exists("GridFieldSortableRows")) {
$grid->getConfig()->addComponent(new GridFieldSortableRows('SortOrder'));
}
}
示例13: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// this is what shows int he tab with the table in it
/*
$tablefield = new HasOneComplexTableField(
$this,
'FlickrSetForPage',
'FlickrSet',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$tablefield->setParentClass('FLickrSetPage');
*/
$gridConfig = GridFieldConfig_RelationEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'));
$gridConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('URL', 'Title', 'Description'));
//$gridField = new GridField( "Links", "List of Links:", $this->Links()->sort( 'SortOrder' ), $gridConfig );
//$fields->addFieldToTab( "Root.Links", $gridField );
$fields->addFieldToTab('Root.Main', new HTMLEditorField('Description', 'Description'), 'Content');
//fields->addFieldToTab( 'Root.FlickrSet', $tablefield );
//$dropdown = new DropdownField('FlickrSetFolderID', 'Flickr Set Folder', FlickrSetFolder::get()->map('ID','Title');
/*
$dropdown->setEmptyString('-- Please Select One --');
$fields->addFieldToTab('Root.ParentGallery',
$dropdown
);
*/
return $fields;
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Main Content tab
// Carousel tab
$carouselItemsGrid = null;
// Manay to many relations can only be established if we have an id. So put a place holder instead of a grid if this is a new object.
if ($this->ID == 0) {
$carouselItemsGrid = TextField::create("CarouselItems", "Carousel Items")->setDisabled(true)->setValue("Page must be saved once before adding Carousel Items.");
} else {
$carouselItemsGrid = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create());
$carouselItemsGridUploadComponent = new GridFieldBulkUpload("Image");
$carouselItemsGridUploadComponent->setUfSetup("setFolderName", $this->ImageFolder("carousel"));
$carouselItemsGrid->setModelClass('CarouselItem')->getConfig()->addComponent($carouselItemsGridUploadComponent)->addComponent(new GridFieldOrderableRows("SortID"));
}
$fields->addFieldToTab('Root.Carousel', $carouselItemsGrid);
// Links
$fields->addFieldToTab('Root.Links', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree'));
$fields->addFieldToTab('Root.Links', new TextField('LearnMoreButtonText', 'Text to display on the "Learn More" button:', 'SiteTree'));
$quickLinksGrid = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create());
$quickLinksGrid->setModelClass('Quicklink');
$quickLinksFieldGroup = FieldGroup::create($quickLinksGrid)->setTitle('Quick Links');
$quickLinksFieldGroup->setName("QuicklinkGroup");
$fields->addFieldToTab('Root.Links', $quickLinksFieldGroup);
$fields->removeByName('Translations');
$fields->removeByName('Import');
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues()), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3));
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues()), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3));
return $fields;
}
示例15: updateCMSFields
/**
* CMS Fields
* @return FieldList
*/
public function updateCMSFields(FieldList $fields)
{
if (!Permission::check("VIEW_SECTIONS")) {
return $fields;
}
$SectionGrid = GridFieldConfig_RelationEditor::create()->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewMultiClass())->addComponent(new GridFieldOrderableRows());
$SectionGrid->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('AdminTitle', 'MenuTitle'))->setResultsFormat('$AdminTitle - $Type');
$AvailableTypes = $this->AvailableSectionTypes();
foreach ($AvailableTypes as $key => $value) {
if ($value['selectable_option'] && !$value['limit_reached']) {
$AvailableTypes[$key] = $value['type'];
}
}
$SectionGrid->getComponentByType('GridFieldAddNewMultiClass')->setClasses($AvailableTypes);
// Limit total sections
$LimitSectionTotal = Config::inst()->get($this->owner->ClassName, 'LimitSectionTotal');
if (isset($LimitSectionTotal) && $this->owner->Sections()->Count() >= $LimitSectionTotal) {
// remove the buttons if we don't want to allow more records to be added/created
$SectionGrid->removeComponentsByType('GridFieldAddNewButton');
$SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
$SectionGrid->removeComponentsByType('GridFieldAddNewMultiClass');
}
if (!Permission::check("LINK_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
}
if (!Permission::check("REORDER_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldOrderableRows');
}
if (!Permission::check("UNLINK_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldDeleteAction');
}
$fields->addFieldToTab('Root.Section', GridField::create('Sections', 'Current Section(s)', $this->owner->Sections(), $SectionGrid));
$fields->addFieldToTab('Root.Preview', UploadField::create('PreviewImage', 'Preview image')->setFolderName('Preview'));
return $fields;
}