Advertisement
Guest User

Homepage.php

a guest
Jul 25th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. class HomePage extends Page {
  3.  
  4. public static $db = array(
  5. );
  6.  
  7. public static $has_one = array(
  8. );
  9.  
  10. public static $has_many = array(
  11. 'HomeBanners' => 'HomeBanners',
  12. );
  13.  
  14. function getCMSFields() {
  15. $fields = parent::getCMSFields();
  16.  
  17. //Banners
  18. $bannerTable = new DataObjectManager(
  19. $this,
  20. 'HomeBanners',
  21. 'HomeBanners',
  22. array(
  23. 'Description' => 'Description',
  24. 'Thumbnail' => 'Image'
  25. ),
  26. 'getCMSFields_forPopup'
  27. );
  28. $bannerTable->setAddTitle('Banner');
  29. $fields->addFieldToTab('Root.Content.Banners', $bannerTable);
  30.  
  31. return $fields;
  32. }
  33.  
  34. }
  35. class HomePage_Controller extends Page_Controller {
  36.  
  37. /**
  38. * An array of actions that can be accessed via a request. Each array element should be an action name, and the
  39. * permissions or conditions required to allow the user to access it.
  40. *
  41. * <code>
  42. * array (
  43. * 'action', // anyone can access this action
  44. * 'action' => true, // same as above
  45. * 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
  46. * 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
  47. * );
  48. * </code>
  49. *
  50. * @var array
  51. */
  52. public static $allowed_actions = array (
  53. );
  54.  
  55. public function init() {
  56. parent::init();
  57.  
  58. // Note: you should use SS template require tags inside your templates
  59. // instead of putting Requirements calls here. However these are
  60. // included so that our older themes still work
  61. Requirements::themedCSS('layout');
  62. Requirements::themedCSS('typography');
  63. Requirements::themedCSS('form');
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement