Пример #1
0
 /**
  * Retrieve the fields used by SortableUploadField internal form.
  *
  * @return FieldList
  */
 public function getCarouselEditFields()
 {
     // This is *required* otherwise TinyMCE in SilverStripe 3.3 will
     // not be enabled and the <textarea> will simply disappear
     // without apparent reasons
     if (method_exists('HtmlEditorConfig', 'require_js')) {
         HtmlEditorConfig::require_js();
     }
     $fields = FieldList::create();
     $fields->push(CarouselCaptionField::create('Content', _t('CarouselPage.Caption')));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $field = SortableUploadField::create('Images', _t('CarouselPage.db_Images'));
     $field->setFolderName($this->getClassFolder());
     // Enable HTML caption handling if captions are enabled
     if ($this->Captions) {
         $caption = CarouselCaptionField::create('Content', _t('CarouselPage.Caption'));
         $field->setFileEditFields(FieldList::create($caption));
         unset($caption);
     }
     $root = $fields->fieldByName('Root');
     $tab = $root->fieldByName('Images');
     if (!$tab) {
         $tab = Tab::create('Images');
         $tab->setTitle(_t('CarouselPage.db_Images'));
         $root->insertAfter($tab, 'Main');
     }
     $tab->push($field);
     return $fields;
 }