Advertisement
Guest User

Untitled

a guest
Jun 4th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class BannerPage extends Page {
  2.  
  3.     public static $db = array(
  4.    
  5.     );
  6.  
  7.     public static $has_one = array(
  8.         "LeftBanner" => "TextBanner",
  9.         "RightBanner" => "TextBanner"
  10.     );
  11.  
  12.     public function getCMSFields() {
  13.         $fields = parent::getCMSFields();
  14.         $fields->addFieldsToTab("Root.LeftBanner", $this->LeftBanner()->getCMSFields());
  15.         $fields->addFieldsToTab("Root.RightBanner", $this->RightBanner()->getCMSFields());
  16.         return $fields;
  17.     }
  18.  
  19. }
  20.  
  21. class BannerPage_Controller extends Page_Controller {
  22.  
  23. }
  24.  
  25. class TextBanner extends DataObject {
  26.  
  27.     public static $db = array(
  28.         "BackgroundColour" => "Varchar(6)",
  29.         "Content" => "HTMLText"
  30.     );
  31.  
  32.     public static $has_one = array(
  33.         "BottomImage" => "Image"
  34.     );
  35.  
  36.     public function getCMSFields() {
  37.         return new FieldList(
  38.             new TextField("BackgroundColour", "Background Colour (hex)"),
  39.             new UploadField("BottomImage", "Bottom Image"),
  40.             new HTMLEditorField("Content", "Content")
  41.         );
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement