Skip to content

Instantly share code, notes, and snippets.

@howardgrigg
Created February 23, 2014 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howardgrigg/46e7fd9065e3c173aa8e to your computer and use it in GitHub Desktop.
Save howardgrigg/46e7fd9065e3c173aa8e to your computer and use it in GitHub Desktop.
function getCMSFields() {
$f = new FieldList(
TextField::create('Title'),
HTMLEditorField::create('Content'),
$singleorshow = OptionsetField::create('SingleOrShow','Single Image or Slideshow?', singleton('PageSection')->dbObject('SingleOrShow')->enumValues()),
$single = DisplayLogicWrapper::create(
$image = UploadField::create('Image'),
$imageonleft = CheckboxField::create('ImageOnLeft', 'Tick for a vertical image format'),
$borderbottom = CheckboxField::create('BorderBottom', 'Tick for no padding below image')
),
$show = DisplayLogicWrapper::create(
$grid = GridField::create('Slides', 'Slideshow', $this->Slides(), GridFieldConfig_RelationEditor::create())
)
);
$single->displayIf("SingleOrShow")->isEqualTo("Single");
$show->displayIf("SingleOrShow")->isEqualTo("Slideshow");
return $f;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment