Skip to content

Instantly share code, notes, and snippets.

@ss23
Created May 1, 2013 14:56
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 ss23/5495755 to your computer and use it in GitHub Desktop.
Save ss23/5495755 to your computer and use it in GitHub Desktop.
<?php
class HomePage extends Page {
public static $db = array(
);
public static $has_one = array(
);
public static $has_many = array('Images' => 'Image');
public function getCMSFields() {
$fields = parent::getCMSFields();
$gridFieldConfig = GridFieldConfig_RelationEditor::create();
$gridFieldConfig->getComponentByType('GridFieldAddNewButton')->setButtonName('Add New Image');
$gridField = new GridField("Images", "Images", $this->Images(), $gridFieldConfig);
$gridField->setRightTitle('Add images to the slider');
$fields->addFieldsToTab('Root.Images', $gridField);
return $fields;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment