• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP GridFieldConfig_RelationEditor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中GridFieldConfig_RelationEditor的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig_RelationEditor类的具体用法?PHP GridFieldConfig_RelationEditor怎么用?PHP GridFieldConfig_RelationEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GridFieldConfig_RelationEditor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:32,代码来源:OpenStackSampleConfigAdminUI.php


示例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;
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:31,代码来源:PresentationCategory.php


示例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);
 }
开发者ID:markguinn,项目名称:silverstripe-featureditems,代码行数:12,代码来源:LinksToVideos.php


示例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;
 }
开发者ID:heyday,项目名称:heystack-ecommerce-coredb,代码行数:15,代码来源:Zone.php


示例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;
 }
开发者ID:helpfulrobot,项目名称:plato-creative-plato-silverstripe-gallery,代码行数:17,代码来源:GalleryPage.php


示例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;
 }
开发者ID:nyeholt,项目名称:silverstripe-elemental,代码行数:31,代码来源:ElementPageExtension.php


示例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'));
     }
 }
开发者ID:helpfulrobot,项目名称:silvermax-maxskitter,代码行数:7,代码来源:MaxSkitterDecorator.php


示例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;
 }
开发者ID:itlooks,项目名称:silverstripe-responsive-gallery,代码行数:33,代码来源:ResponsiveGalleryExtension.php


示例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'));
     }
 }
开发者ID:helpfulrobot,项目名称:silvermax-maxcarousel,代码行数:7,代码来源:MaxCarouselPageExtension.php


示例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;
 }
开发者ID:gordonbanderson,项目名称:flickr-editor,代码行数:32,代码来源:FlickrSetPage.php


示例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;
 }
开发者ID:guru-digital,项目名称:gdm-ss-express,代码行数:30,代码来源:ExpressHomePage.php


示例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;
 }
开发者ID:coreiho,项目名称:silverstripe-sections,代码行数:39,代码来源:SectionPageExtension.php


示例16: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('PageBuilder');
     /* =========================================
        * Images
        =========================================*/
     $fields->addFieldToTab('Root.Main', new UploadField('Image'), 'Content');
     /* =========================================
        * Menu Item Details
        =========================================*/
     $fields->addFieldToTab('Root.Main', $price = new CurrencyField('Price'), 'Content');
     $price->setRightTitle('To add extra price options e.g Small, Large please add a variation under the "Variations" tab above');
     $fields->addFieldToTab('Root.Main', $ingredients = new HtmlEditorField('Ingredients'), 'Metadata');
     $ingredients->setRows(15);
     /* =========================================
        * Variations
        =========================================*/
     $config = GridFieldConfig_RelationEditor::create(10);
     $config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction());
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'Price' => 'Price'));
     $gridField = new GridField('Variations', 'Variations', $this->owner->MenuVariations(), $config);
     $fields->addFieldToTab('Root.Variations', $gridField);
     return $fields;
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:25,代码来源:MenuItem.php


示例17: getCMSFields

 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $homes = Home::get();
     $f->addFieldToTab('Root.Homes', new GridField('HomeGrid', 'Homes', $homes, GridFieldConfig_RelationEditor::create()));
     return $f;
 }
开发者ID:prostart,项目名称:erics-homes,代码行数:7,代码来源:AvailableHomesPage.php


示例18: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     parent::updateCMSFields($fields);
     // Loop over each WidgetArea
     $has_one = $this->owner->has_one();
     foreach ($has_one as $name => $class) {
         if ($class == 'WidgetArea') {
             /*
              * Widget gridfield 
              */
             $adder = new GridFieldAddNewMultiClass();
             // Allowed classes
             $allowed = $this->owner->config()->get("allowed_widgets");
             if (is_array($allowed)) {
                 // Filter classes for creating new ones
                 $adder->setClasses($allowed);
             }
             $config = GridFieldConfig_RelationEditor::create()->removeComponentsByType("GridFieldAddNewButton")->addComponent($adder)->addComponent(new GridFieldOrderableRows('WidgetAreaSort'));
             // It's not possible to add existing through GridFieldAddExistingSearchButton since
             // it display by default $Title in its template and we want to search by $WidgetName
             $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('WidgetName'))->setResultsFormat('$WidgetName');
             // WidgetArea's Widget GridField
             $gridField = GridField::create($name, $name, $this->owner->{$name}()->SortedWidgets(false))->setConfig($config);
             $fields->addFieldToTab("Root.{$name}", $gridField);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:zirak-widget-pages-extension,代码行数:27,代码来源:WidgetDataObject.php


示例19: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ID) {
         // Relation handler for Blocks
         $SConfig = GridFieldConfig_RelationEditor::create(25);
         $SConfig->addComponent(new GridFieldOrderableRows('SortOrder'));
         $SConfig->addComponent(new GridFieldDeleteAction());
         // If the copy button module is installed, add copy as option
         if (class_exists('GridFieldCopyButton')) {
             $SConfig->addComponent(new GridFieldCopyButton(), 'GridFieldDeleteAction');
         }
         $gridField = new GridField("Blocks", "Content blocks", $this->owner->Blocks(), $SConfig);
         $classes = array_values(ClassInfo::subclassesFor($gridField->getModelClass()));
         if (count($classes) > 1 && class_exists('GridFieldAddNewMultiClass')) {
             $SConfig->removeComponentsByType('GridFieldAddNewButton');
             $SConfig->addComponent(new GridFieldAddNewMultiClass());
         }
         if (self::$create_block_tab) {
             $fields->addFieldToTab("Root.Blocks", $gridField);
         } else {
             // Downsize the content field
             $fields->removeByName('Content');
             $fields->addFieldToTab('Root.Main', HTMLEditorField::create('Content')->setRows(self::$contentarea_rows), 'Metadata');
             $fields->addFieldToTab("Root.Main", $gridField, 'Metadata');
         }
     }
     return $fields;
 }
开发者ID:Design-Collective,项目名称:Silverstripe-Content-Blocks,代码行数:28,代码来源:ContentBlocksModule.php


示例20: getCMSFields

 public function getCMSFields()
 {
     Requirements::javascript('google-store-finder/javascript/store-creator.js');
     $fields = parent::getCMSFields();
     // Create a gridfield to hold the student relationship
     $latField = new NumericField('StartLat', 'Starting Latitude', 40);
     $longField = new NumericField('StartLong', 'Starting Longitude', -100);
     $zoomField = new NumericField('StartZoom', 'Starting Zoom', 2);
     $geoLocatedZoomField = new NumericField('GeolocatedZoom', "Geolocated Zoom", 8);
     $mapType = new DropdownField('MapType', 'Map Type', array("RoadMap" => "Road Map", "Satellite" => "Satellite"), "RoadMap");
     // Create a tab named "Students" and add our field to it
     $fields->addFieldToTab('Root.Map', new LiteralField("geolocation-explanation", '<p>This Module will attempt to detect users location if their device supports it.  if not, please enter the starting latitude and longitude. (Default values center North and South America in the map).</p>'));
     $fields->addFieldToTab('Root.Map', $latField);
     $fields->addFieldToTab('Root.Map', $longField);
     $fields->addFieldToTab('Root.Map', $zoomField);
     $fields->addFieldToTab('Root.Map', $geoLocatedZoomField);
     $fields->addFieldToTab('Root.Map', $mapType);
     $markerClassObject = Injector::inst()->create(self::$MarkerClass);
     // Create a default configuration for the new GridField, allowing record editing
     $config = GridFieldConfig_RelationEditor::create();
     // Set the names and data for our gridfield columns
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name'));
     // Create a gridfield to hold the student relationship
     $locationField = new GridField(self::$MarkerClass, DataObject::get_static(self::$MarkerClass, "singular_name"), DataObject::get(self::$MarkerClass), $config);
     // Create a tab named "Students" and add our field to it
     $fields->addFieldToTab('Root.Locations', $locationField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:cbryer-silverstripe-google-store-finder,代码行数:28,代码来源:StoreFinder.php



注:本文中的GridFieldConfig_RelationEditor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP GridField_FormAction类代码示例发布时间:2022-05-23
下一篇:
PHP GridFieldConfig_RecordEditor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap