Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BannerPage extends Page {
- public static $db = array(
- );
- public static $has_one = array(
- "LeftBanner" => "TextBanner",
- "RightBanner" => "TextBanner"
- );
- public function getCMSFields() {
- $fields = parent::getCMSFields();
- $fields->addFieldsToTab("Root.LeftBanner", $this->LeftBanner()->getCMSFields());
- $fields->addFieldsToTab("Root.RightBanner", $this->RightBanner()->getCMSFields());
- return $fields;
- }
- }
- class BannerPage_Controller extends Page_Controller {
- }
- class TextBanner extends DataObject {
- public static $db = array(
- "BackgroundColour" => "Varchar(6)",
- "Content" => "HTMLText"
- );
- public static $has_one = array(
- "BottomImage" => "Image"
- );
- public function getCMSFields() {
- return new FieldList(
- new TextField("BackgroundColour", "Background Colour (hex)"),
- new UploadField("BottomImage", "Bottom Image"),
- new HTMLEditorField("Content", "Content")
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement