public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         // Summit Images
         $summitImageField = singleton('SummitImage')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($summitImageField);
         $gridField = new GridField('SummitImage', 'SummitImage', SummitImage::get(), $config);
         $fields->addFieldToTab('Root.SummitPageImages', $gridField);
         // Summit Image has_one selector
         $dropdown = DropdownField::create('SummitImageID', 'Please choose an image for this page', SummitImage::get()->map("ID", "Title", "Please Select"))->setEmptyString('(None)');
         $fields->addFieldToTab('Root.Main', $dropdown);
         $fields->addFieldsToTab('Root.Main', $ddl_summit = new DropdownField('SummitID', 'Summit', Summit::get()->map('ID', 'Name')));
         $ddl_summit->setEmptyString('(None)');
     }
     $fields->addFieldsToTab('Root.Main', new TextField('HeroCSSClass', 'Hero CSS Class'));
     //Google Conversion Tracking params
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionId", "Conversion Id", "994798451"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLanguage", "Conversion Language", "en"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionFormat", "Conversion Format", "3"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new ColorField("GAConversionColor", "Conversion Color", "ffffff"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLabel", "Conversion Label", "IuM5CK3OzQYQ89at2gM"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionValue", "Conversion Value", "0"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new CheckboxField("GARemarketingOnly", "Remarketing Only"));
     //Facebook Conversion Params
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBPixelId", "Pixel Id", "6013247449963"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBValue", "Value", "0.00"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBCurrency", "Currency", "USD"));
     //Twitter
     $fields->addFieldToTab("Root.TwitterConversionTracking", new TextField("TwitterPixelId", "Pixel Id", "l5lav"));
     return $fields;
 }
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     //current summit
     $f->removeByName('Content');
     $f->addFieldToTab('Root.CurrentSummit', new HtmlEditorField('ThankYouText', 'ThankYouText'));
     $f->addFieldToTab('Root.CurrentSummit', new TextField('CurrentSummitFlickrUrl', 'Flickr Url'));
     $image = new UploadField('CurrentSummitBackgroundImage', 'Background Image');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/', $this->SummitID));
     $f->addFieldToTab('Root.CurrentSummit', $image);
     // statistics
     $f->addFieldToTab('Root.Statistics', new TextField('AttendanceQty', 'Attendance Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('CompaniesRepresentedQty', 'Companies Represented Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('CountriesRepresentedQty', 'Countries Represented Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('StatisticsVideoUrl', 'Video Url'));
     $file = new UploadField('StatisticsVideo', 'Video');
     $file->setAllowedMaxFileNumber(1);
     $file->setAllowedExtensions(array('mp4'));
     $file->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
     $f->addFieldToTab('Root.Statistics', $file);
     $image = new UploadField('StatisticsVideoPoster', 'Video Poster');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
     $f->addFieldToTab('Root.Statistics', $image);
     // next summit
     $f->addFieldToTab('Root.NextSummit', new HtmlEditorField('NextSummitText', 'Next Summit Text'));
     $dropdown = DropdownField::create('NextSummitBackgroundImageID', 'Please choose an image for this page', SummitImage::get()->map("ID", "Title", "Please Select"))->setEmptyString('(None)');
     $f->addFieldToTab('Root.NextSummit', $dropdown);
     $image = new UploadField('NextSummitTinyBackgroundImage', 'Promo Background Image');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/next_summit/', $this->SummitID));
     $f->addFieldToTab('Root.NextSummit', $image);
     // release
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedTitle', 'Title'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new HtmlEditorField('ReleaseAnnouncedDescription', 'Description'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonTitle', 'Button Text'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonLink', 'Button Link'));
     $release_image = new UploadField('ReleaseAnnouncedImage', 'Image');
     $release_image->setAllowedMaxFileNumber(1);
     $release_image->setFolderName(sprintf('summits/%s/highlights/release/', $this->SummitID));
     $f->addFieldToTab('Root.ReleaseAnnounced', $release_image);
     if ($this->ID > 0) {
         $config = GridFieldConfig_RecordEditor::create();
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('KeynotesImages', 'KeynotesImages', $this->KeynotesImages(), $config);
         $f->addFieldToTab('Root.KeyNotesImages', $gridField);
         $config = GridFieldConfig_RecordEditor::create();
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('Pics', 'Pics', $this->Pics(), $config);
         $f->addFieldToTab('Root.Pics', $gridField);
     }
     return $f;
 }