/**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // remove the content block
     $fields->removeByName('Content');
     // Add a gallery gridfield for the images.
     $fields->addFieldToTab('Root.Main', SortableGalleryField::create('Images'), 'Metadata');
     // add configuration tab for the height
     $fields->addFieldsToTab('Root.Configuration', array(NoticeMessage::create('This value defines the height of an image row (in pixel).'), TextField::create('Height')));
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $hiddenFields = $this->config()->get('hideCMSInputs');
     // short title?
     if (!in_array('AlternativeTitle', $hiddenFields)) {
         $fields->addFieldToTab('Root.Main', TextField::create('AlternativeTitle', 'Alternative Title'), 'URLSegment');
     }
     // do we want an intro?
     if (!in_array('Intro', $hiddenFields)) {
         $fields->addFieldToTab('Root.Main', TextareaField::create('Intro', 'Intro'), 'Content');
     }
     // add an image
     if (!in_array('Image', $hiddenFields)) {
         $fields->addFieldToTab('Root.Main', UploadField::create('ImageID', 'Image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1), 'Content');
     }
     // do we use a section color?
     if (!in_array('Color', $hiddenFields)) {
         // default is this brand color.
         $field = NoticeMessage::create('The brand colors have not been defined yet.');
         // usually we replace this with the color palette.
         if (BrandColors::get()->count() > 0) {
             $field = ColorPaletteField::create('Color', 'Color', BrandColors::get()->map('BrandColor', 'ColorName'))->setRightTitle('Please select a brand color.');
         }
         $fields->addFieldToTab('Root.Main', $field, 'Content');
     }
     // It will repalce Content area field to notice message field, or nothing at the end.
     if ($this->config()->get('useBlocksModule')) {
         // move the block related fields over
         $fields->addFieldsToTab('Root.Main', $fields->findOrMakeTab('Root.Blocks')->Fields(), 'Content');
         // now we really don't need the content field anymore.
         $fields->removeByName('Content');
         // remove the blocks tab
         $fields->removeByName('Root.Blocks');
     }
     if ($this->config()->get('hideContentField')) {
         $fields->removebyName('Content');
     }
     return $fields;
 }