@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | $this->beforeUpdateCMSFields(function ($fields) { |
| 11 | 11 | $fields->renameField("Content", "Intro Content"); |
| 12 | - $fields->insertBefore(new Tab($this->getLumberjackTitle()), 'Main'); |
|
| 12 | + $fields->insertBefore(new Tab($this->getLumberjackTitle()), 'Main'); |
|
| 13 | 13 | }); |
| 14 | 14 | |
| 15 | 15 | $fields = parent::getCMSFields(); |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function getLumberjackPagesForGridfield($excluded = array()) |
| 30 | - { |
|
| 31 | - return NewsArticle::get()->filter(array( |
|
| 32 | - 'ParentID' => $this->ID, |
|
| 33 | - 'ClassName' => $excluded, |
|
| 34 | - )); |
|
| 35 | - } |
|
| 30 | + { |
|
| 31 | + return NewsArticle::get()->filter(array( |
|
| 32 | + 'ParentID' => $this->ID, |
|
| 33 | + 'ClassName' => $excluded, |
|
| 34 | + )); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | // Only allows certain children to be created |
| 38 | 38 | private static $allowed_children = array('NewsArticle'); |
@@ -1,27 +1,27 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class CustomLumberjack extends Lumberjack { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * This is responsible for adding the child pages tab and gridfield. |
|
| 6 | - * CUSTOM: Customised to make the GridField tab first. |
|
| 7 | - * |
|
| 8 | - * @param FieldList $fields |
|
| 9 | - */ |
|
| 10 | - public function updateCMSFields(FieldList $fields) { |
|
| 11 | - $excluded = $this->owner->getExcludedSiteTreeClassNames(); |
|
| 12 | - if(!empty($excluded)) { |
|
| 13 | - $pages = $this->getLumberjackPagesForGridfield($excluded); |
|
| 14 | - $gridField = new GridField( |
|
| 15 | - "ChildPages", |
|
| 16 | - $this->getLumberjackTitle(), |
|
| 17 | - $pages, |
|
| 18 | - $this->getLumberjackGridFieldConfig() |
|
| 19 | - ); |
|
| 4 | + /** |
|
| 5 | + * This is responsible for adding the child pages tab and gridfield. |
|
| 6 | + * CUSTOM: Customised to make the GridField tab first. |
|
| 7 | + * |
|
| 8 | + * @param FieldList $fields |
|
| 9 | + */ |
|
| 10 | + public function updateCMSFields(FieldList $fields) { |
|
| 11 | + $excluded = $this->owner->getExcludedSiteTreeClassNames(); |
|
| 12 | + if(!empty($excluded)) { |
|
| 13 | + $pages = $this->getLumberjackPagesForGridfield($excluded); |
|
| 14 | + $gridField = new GridField( |
|
| 15 | + "ChildPages", |
|
| 16 | + $this->getLumberjackTitle(), |
|
| 17 | + $pages, |
|
| 18 | + $this->getLumberjackGridFieldConfig() |
|
| 19 | + ); |
|
| 20 | 20 | |
| 21 | - $tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField); |
|
| 22 | - // $fields->insertAfter($tab, 'Main'); |
|
| 23 | - $fields->insertBefore($tab, 'Main'); // Only modified line |
|
| 24 | - } |
|
| 25 | - } |
|
| 21 | + $tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField); |
|
| 22 | + // $fields->insertAfter($tab, 'Main'); |
|
| 23 | + $fields->insertBefore($tab, 'Main'); // Only modified line |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |