Advertisement
Guest User

Untitled

a guest
Oct 17th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class ccTopicPage extends Page {
  5.  
  6. private static $db = array();
  7.  
  8. public static $has_many = array(
  9. 'allLink' => 'ccQLink',
  10. 't1Link' => 'ccQLink'
  11. );
  12.  
  13.  
  14. public function getCMSFields() {
  15. $f = parent::getCMSFields();
  16.  
  17. $fNew = array();
  18.  
  19. $fNew[] = ReadonlyField::create('allTitle', 'Common to all Policies')->addExtraClass('stacked');
  20. $fNew[] = new GridField('allLink', 'Question Link', $this->allLink()->sort("sortOrder"), GridFieldConfig_RecordEditor::create());
  21.  
  22. // // Topic #1
  23. $fNew[] = TextField::create('t1Title', 'Topic #1 Title')->addExtraClass('stacked');
  24. $fNew[] = new GridField('t1Link','T1 Link',$this->t1Link()->sort("sortOrder"), GridFieldConfig_RecordEditor::create());
  25. $f->addFieldsToTab('Root.Main', $fNew);
  26.  
  27. return $f;
  28. }
  29. }
  30.  
  31. class ccTopicPage_Controller extends Page_Controller {}
  32.  
  33.  
  34. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35.  
  36.  
  37.  
  38. class ccQLink extends DataObject {
  39.  
  40. public static $has_one = array(
  41. 'Page' => 'Page',
  42. 'Link' => 'Link'
  43. );
  44.  
  45. public static $summary_fields = array(
  46. 'Link.Title' => 'Link'
  47. );
  48.  
  49.  
  50. public function getCMSFields() {
  51. $f = parent::getCMSFields();
  52.  
  53. $fNew = array();
  54. $fNew[] = LinkField::create('LinkID','Link');
  55. $f->addFieldsToTab('Root.Main', $fNew);
  56.  
  57. return $f;
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement