setAppendToTop() 공개 메소드

Sets if new records should be appended to the top or the bottom of the list
public setAppendToTop ( boolean $value ) : GridFieldSortableRows
$value boolean Boolean true to append to the top false to append to the bottom
리턴 GridFieldSortableRows Returns the current instance
 public function getCMSFields()
 {
     $DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover');
     $DefaultAlbumCoverField->folderName = "PhotoGallery";
     $DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $fields = parent::getCMSFields();
     $AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID')));
     if ($this->AlbumDefaultTop == true) {
         $sortable->setAppendToTop(true);
     }
     $fields->addFieldToTab("Root.Albums", $AlbumsGridField);
     $fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings"));
     $fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField);
     $fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25));
     $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty"));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default"));
     $fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings"));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200));
     $fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default"));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.Main", new TextField("Description", "Description", "", 100));
     $conf = GridFieldConfig_RelationEditor::create(10);
     $conf->addComponent($sortable = new GridFieldSortableRows('SortID'));
     //Append new GalleryItems to the top
     $sortable->setAppendToTop(true);
     $field = TagField::create('GalleryTags', 'Gallery Tags', GalleryTag::get(), $this->GalleryTags())->setShouldLazyLoad(true)->setCanCreate(true);
     // new tag DataObjects can be created;
     $fields->addFieldToTab('Root.Tags', $field);
     $fields->addFieldToTab('Root.MyAlbum', new GridField('GalleryItems', 'My Album', $this->GalleryItems(), $conf));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', HTMLEditorField::create('BottomContent')->setTitle('Content for below the list items'), 'Metadata');
     $fields->addFieldToTab('Root.ListItems', GridField::create('ListItems', 'List Items', $this->ListItems(), GridFieldConfig_RecordEditor::create('50')->addComponent($sortableitems = new GridFieldSortableRows('SortID'))));
     $sortableitems->setAppendToTop(true);
     $fields->addFieldToTab('Root.ListCategories', GridField::create('ListCategories', 'List Categories', $this->ListCategories(), GridFieldConfig_RecordEditor::create('50')->addComponent($sortablecategories = new GridFieldSortableRows('SortID'))));
     $sortablecategories->setAppendToTop(true);
     $fields->addFieldToTab('Root.Config', HeaderField::create('ListItemsDesc')->setTitle('List Items Options'));
     $fields->addFieldToTab('Root.Config', CheckboxField::create('AlphabeticalOrder')->setTitle('Alphabetical Order for List Items')->setDescription('Show in alphabetical order (By the list item title, overwrites drag and drop order)'));
     $fields->addFieldToTab('Root.Config', CheckboxField::create('ToggleEffectItems')->setTitle('Toggle Effect for List Items')->setDescription('Set toggle effect on list items'));
     $fields->addFieldToTab("Root.Config", SliderField::create("PhotoMaxWidth", "Max Photo Width", 50, 1600)->setDescription('For photo that is associated with list items'));
     $fields->addFieldToTab('Root.Config', HeaderField::create('ListCategoriesDesc')->setTitle('List Categories Options'));
     $fields->addFieldToTab('Root.Config', CheckboxField::create('AlphaOrderCategories')->setTitle('Alphabetical Order for List Categories')->setDescription('Show in alphabetical order (By the list category title, overwrites drag and drop ordering)'));
     $fields->addFieldToTab('Root.Config', CheckboxField::create('ToggleEffect')->setTitle('Toggle Effect for List Cateogries')->setDescription('Set toggle effect on list categories'));
     $fields->addFieldToTab('Root.Config', CheckboxField::create('StartToggleClosed')->setTitle('Start Toggle Closed for List Categories')->setDescription('The toggle for all catogries will start closed, if off the first category toggle will be open'));
     return $fields;
 }
 public function getCMSFields()
 {
     if ($this->ID == 0) {
         $PhotosGridField = TextField::create('PhotosDisclaimer')->setTitle('Photos')->setDisabled(true)->setValue('You can add photos once you have saved the record for the first time.');
         $ImageField = TextField::create('AlbumCoverDisclaimer')->setTitle('Album Cover Photo')->setDisabled(true)->setValue('You can add an album cover once you have saved the record for the first time.');
     } else {
         $BulkUploadComponent = new GridFieldBulkUpload();
         $BulkUploadComponent->setUfSetup('setFolderName', "photogallery/" . $this->PageFolder() . "/" . $this->AlbumFolder());
         $PhotosGridField = new GridField('PhotoItems', 'Photos', $this->PhotoItems(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton("toolbar-header-right"))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent(new GridFieldBulkManager())->addComponent($BulkUploadComponent)->addComponent($sortable = new GridFieldSortableRows('SortID')));
         if ($this->getComponent('PhotoGallery')->PhotoDefaultTop == true) {
             $sortable->setAppendToTop(true);
         }
         $ImageField = UploadField::create('AlbumCover')->setTitle('Album Cover Photo');
         $ImageField->folderName = 'photogallery/' . $this->PageFolder();
         $ImageField->getValidator()->allowedExtensions = array("jpg", "jpeg", "gif", "png");
     }
     $Fields = new FieldList(TextField::create('Name'), TextareaField::create('Description'), $ImageField, $PhotosGridField);
     $this->extend('updateCMSFields', $Fields);
     return $Fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     parent::updateCMSFields($fields);
     $fields->removeByName('Images');
     $name = Config::inst()->get('SimpleGalleryExtension', 'gallery_name');
     if ($this->owner->ID > 0) {
         $folder = Config::inst()->get('SimpleGalleryExtension', 'folder_path');
         if (strlen($folder) == 0) {
             $folder = 'simplegallery';
         }
         $gridFieldConfig = GridFieldConfig_RecordEditor::create();
         $bu = new GridFieldBulkImageUpload('Image', array('Title'));
         $bu->setConfig('folderName', $folder);
         $gridFieldConfig->addComponent($bu);
         $gridFieldSortableRows = new GridFieldSortableRows('SortOrder');
         $gridFieldConfig->addComponent($gridFieldSortableRows->setAppendToTop(true));
         $gridfield = new GridField("Gallery", $name, $this->SortedImages(true), $gridFieldConfig);
         $fields->addFieldToTab('Root.' . $name, $gridfield);
     }
     return $fields;
 }