@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $image->setRightTitle("Displayed to the right of the content in the main article, where it can be clicked to enlarge. <br />A thumbnail also appears next to the article summary on the main News page."); |
| 55 | 55 | $fields->addFieldToTab('Root.Main', $image, "Content"); |
| 56 | 56 | |
| 57 | - }); |
|
| 57 | + }); |
|
| 58 | 58 | |
| 59 | 59 | $fields = parent::getCMSFields(); |
| 60 | 60 | |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | parent::init(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - // Provides a resized image with the max width provided |
|
| 102 | - public function ArticleImageSized($maxwidth = 250) |
|
| 103 | - { |
|
| 104 | - if ($this->AttachedImage()->getWidth() < $maxwidth) { |
|
| 105 | - return $this->AttachedImage(); |
|
| 106 | - } else { |
|
| 107 | - return $this->AttachedImage()->setWidth($maxwidth); |
|
| 108 | - } |
|
| 109 | - } |
|
| 101 | + // Provides a resized image with the max width provided |
|
| 102 | + public function ArticleImageSized($maxwidth = 250) |
|
| 103 | + { |
|
| 104 | + if ($this->AttachedImage()->getWidth() < $maxwidth) { |
|
| 105 | + return $this->AttachedImage(); |
|
| 106 | + } else { |
|
| 107 | + return $this->AttachedImage()->setWidth($maxwidth); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function getCMSFields() |
| 39 | 39 | { |
| 40 | - $this->beforeUpdateCMSFields(function ($fields) { |
|
| 40 | + $this->beforeUpdateCMSFields(function($fields) { |
|
| 41 | 41 | |
| 42 | 42 | $datefield = new DateField('Date', 'Date (DD/MM/YYYY)'); |
| 43 | 43 | $datefield->setConfig('showcalendar', true); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function init() |
| 92 | 92 | { |
| 93 | - if (Director::fileExists(project() . "/css/news.css")) { |
|
| 94 | - Requirements::css(project() . "/css/news.css"); |
|
| 93 | + if (Director::fileExists(project()."/css/news.css")) { |
|
| 94 | + Requirements::css(project()."/css/news.css"); |
|
| 95 | 95 | } else { |
| 96 | 96 | Requirements::css("basic-news/css/news.css"); |
| 97 | 97 | } |
@@ -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 |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | public function updateCMSFields(FieldList $fields) { |
| 11 | 11 | $excluded = $this->owner->getExcludedSiteTreeClassNames(); |
| 12 | - if(!empty($excluded)) { |
|
| 12 | + if (!empty($excluded)) { |
|
| 13 | 13 | $pages = $this->getLumberjackPagesForGridfield($excluded); |
| 14 | 14 | $gridField = new GridField( |
| 15 | 15 | "ChildPages", |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function getLumberjackPagesForGridfield($excluded = array()) |
| 29 | - { |
|
| 30 | - return NewsArticle::get()->filter(array( |
|
| 31 | - 'ParentID' => $this->ID, |
|
| 32 | - 'ClassName' => $excluded, |
|
| 33 | - )); |
|
| 34 | - } |
|
| 29 | + { |
|
| 30 | + return NewsArticle::get()->filter(array( |
|
| 31 | + 'ParentID' => $this->ID, |
|
| 32 | + 'ClassName' => $excluded, |
|
| 33 | + )); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | // Only allows certain children to be created |
| 37 | 37 | private static $allowed_children = array('NewsArticle'); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | $intro = null; |
| 9 | 9 | |
| 10 | - $this->beforeUpdateCMSFields(function ($fields) { |
|
| 10 | + $this->beforeUpdateCMSFields(function($fields) { |
|
| 11 | 11 | $fields->renameField("Content", "Intro Content"); |
| 12 | 12 | }); |
| 13 | 13 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function init() |
| 62 | 62 | { |
| 63 | - RSSFeed::linkToFeed($this->Link() . "rss"); |
|
| 64 | - if (Director::fileExists(project() . "/css/news.css")) { |
|
| 65 | - Requirements::css(project() . "/css/news.css"); |
|
| 63 | + RSSFeed::linkToFeed($this->Link()."rss"); |
|
| 64 | + if (Director::fileExists(project()."/css/news.css")) { |
|
| 65 | + Requirements::css(project()."/css/news.css"); |
|
| 66 | 66 | } else { |
| 67 | 67 | Requirements::css("basic-news/css/news.css"); |
| 68 | 68 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | $rss = new RSSFeed( |
| 78 | 78 | $list = NewsArticle::get(), // an SS_List containing your feed items |
| 79 | 79 | $link = $this->Link("rss"), // a HTTP link to this feed |
| 80 | - $title = $config->Title . " News", // title for this feed, displayed in RSS readers |
|
| 81 | - $description = "All the latest news from ". $config->Title . "." // description |
|
| 80 | + $title = $config->Title." News", // title for this feed, displayed in RSS readers |
|
| 81 | + $description = "All the latest news from ".$config->Title."." // description |
|
| 82 | 82 | ); |
| 83 | 83 | // Outputs the RSS feed to the user. |
| 84 | 84 | return $rss->outputToBrowser(); |