function getCMSFields() { $fields = new FieldList(); $fields->push(new TabSet("Root", $mainTab = new Tab("Main"))); $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main")); $lf = new LiteralField('<p>Instructions', 'All of the images in this bucket will have the same information that you enter here</p>'); $fields->push($lf); $fields->addFieldToTab('Root.Main', $lf); $fields->addFieldToTab('Root.Main', new TextField('Title', 'Bucket Title')); $fields->addFieldToTab('Root.Main', new TextAreaField('Description', 'Bucket Description')); // quick tags, faster than the grid editor - these are processed prior to save to create/assign tags $fields->addFieldToTab('Root.Main', new TextField('QuickTags', 'Quick tags - enter tags here separated by commas')); $lf2 = new LiteralField('ImageStrip', $this->getImageStrip()); $fields->push($lf2); $lockgeo = $this->GeoLocked(); if (!$lockgeo) { $mapField = new LatLongField(array(new TextField('Lat', 'Latitude'), new TextField('Lon', 'Longitude'), new TextField('ZoomLevel', 'Zoom')), array('Address')); $guidePoints = array(); foreach ($this->FlickrSet()->FlickrPhotos()->where('Lat != 0 and Lon != 0') as $fp) { if ($fp->Lat != 0 && $fp->Lon != 0) { array_push($guidePoints, array('latitude' => $fp->Lat, 'longitude' => $fp->Lon)); } } if (count($guidePoints) > 0) { $mapField->setGuidePoints($guidePoints); } $locationTab = $fields->findOrMakeTab('Root.Location'); $locationTab->extraClass('mappableLocationTab'); $fields->addFieldToTab('Root.Location', $mapField); } $gridConfig = GridFieldConfig_RelationEditor::create(); //->addComponent( new GridFieldSortableRows( 'Value' ) ); $gridConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Value', 'RawValue')); $gridField = new GridField("Tags", "List of Tags", $this->FlickrTags(), $gridConfig); // keep in the main tab to avoid wasting time tab switching $fields->addFieldToTab("Root.Main", $gridField); return $fields; }
function getCMSFields() { Requirements::css(FLICKR_EDIT_TOOLS_PATH . '/css/flickredit.js'); $flickrSetID = Controller::curr()->request->param('ID'); $params = Controller::curr()->request->params(); $url = $_GET['url']; $splits = explode('/FlickrSet/item/', $url); $setid = null; if (sizeof($splits) == 2) { $splits = explode('/', $splits[1]); $setid = $splits[0]; } $fields = new FieldList(); $fields->push(new TabSet("Root", $mainTab = new Tab("Main"))); $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main")); $forTemplate = new ArrayData(array('FlickrPhoto' => $this, 'FlickrSetID' => $setid)); $imageHtml = $forTemplate->renderWith('FlickrImageEditing'); $lfImage = new LiteralField('FlickrImage', $imageHtml); $fields->addFieldToTab('Root.Main', $lfImage); $fields->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $fields->addFieldToTab('Root.Main', new TextAreaField('Description', 'Description')); // only show a map for editing if no sets have geolock on them $lockgeo = false; foreach ($this->FlickrSets() as $set) { if ($set->LockGeo == true) { $lockgeo = true; break; } } if (!$lockgeo) { $fields->addFieldToTab("Root.Location", $mapField = new LatLongField(array(new TextField('Lat', 'Latitude'), new TextField('Lon', 'Longitude'), new TextField('ZoomLevel', 'Zoom')), array('Address'))); $guidePoints = array(); foreach ($this->FlickrSets() as $set) { foreach ($set->FlickrPhotos()->where('Lat != 0 and Lon != 0') as $fp) { if ($fp->Lat != 0 && $fp->Lon != 0) { array_push($guidePoints, array('latitude' => $fp->Lat, 'longitude' => $fp->Lon)); } } } if (count($guidePoints) > 0) { $mapField->setGuidePoints($guidePoints); } } // quick tags, faster than the grid editor - these are processed prior to save to create/assign tags $fields->addFieldToTab('Root.Main', new TextField('QuickTags', 'Enter tags here separated by commas')); $gridConfig = GridFieldConfig_RelationEditor::create(); //->addComponent( new GridFieldSortableRows( 'Value' ) ); $gridConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Value', 'RawValue')); $gridField = new GridField("Tags", "List of Tags", $this->FlickrTags(), $gridConfig); $fields->addFieldToTab("Root.Main", $gridField); $fields->addFieldToTab("Root.Main", new CheckboxField('PromoteToHomePage', 'Promote to Home Page')); return $fields; }