-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make use Lumberjack ability to specify children
- Loading branch information
1 parent
5d07904
commit aab733a
Showing
5 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,28 +9,6 @@ Designed to provide a simple, fool-proof way for users to add news articles to t | |
|
||
This module has been designed to have just the minimum required features, to avoid bloat, but can be easily extended to add new fields if required. | ||
|
||
## IMPORTANT ## | ||
|
||
The master branch has been updated to require [micmania1's Lumberjack module](https://github.com/micmania1/silverstripe-lumberjack), which moves the list of news articles from the sitetree to a gridfield. | ||
|
||
However, there are a couple of tweaks required to Lumberjack in order for the best "News" experience. I've opened pull requests, but until they are accepted you can use my Lumberjack fork: | ||
|
||
Just add the following to your composer.json file: | ||
```` | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/purplespider/silverstripe-lumberjack" | ||
} | ||
] | ||
```` | ||
|
||
And to `require` add: | ||
`"micmania1/silverstripe-lumberjack": "1.0.1a"` | ||
|
||
If you don't wish to use this version, you can use the basic-news version 1.0.0 which doesn't use Lumberjack: | ||
`"purplespider/basic-news": "1.0.*"` | ||
|
||
## Maintainer Contact ## | ||
* James Cocker ([email protected]) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
NewsHolder: | ||
extensions: | ||
- 'Lumberjack' | ||
child_classname: NewsArticle | ||
|
||
- 'CustomLumberjack' | ||
NewsArticle: | ||
show_in_sitetree: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
class CustomLumberjack extends Lumberjack { | ||
|
||
/** | ||
* This is responsible for adding the child pages tab and gridfield. | ||
* CUSTOM: Customised to make the GridField tab first. | ||
* | ||
* @param FieldList $fields | ||
*/ | ||
public function updateCMSFields(FieldList $fields) { | ||
$excluded = $this->owner->getExcludedSiteTreeClassNames(); | ||
if(!empty($excluded)) { | ||
$pages = $this->getLumberjackPagesForGridfield($excluded); | ||
$gridField = new GridField( | ||
"ChildPages", | ||
$this->getLumberjackTitle(), | ||
$pages, | ||
$this->getLumberjackGridFieldConfig() | ||
); | ||
|
||
$tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField); | ||
// $fields->insertAfter($tab, 'Main'); | ||
$fields->insertBefore($tab, 'Main'); // Only modified line | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters