ENHANCEMENT Allow Blog RSS feed to be named by CMS field on BlogHolder. If it's not set, then fall back to using "mysite blog" or whatever the global $project variable is set to
This commit is contained in:
parent
203acb4ab7
commit
fffc4d6b77
|
@ -14,6 +14,7 @@ class BlogHolder extends Page {
|
||||||
|
|
||||||
static $db = array(
|
static $db = array(
|
||||||
"LandingPageFreshness" => "Varchar",
|
"LandingPageFreshness" => "Varchar",
|
||||||
|
"Name" => "Varchar"
|
||||||
);
|
);
|
||||||
|
|
||||||
static $has_one = array(
|
static $has_one = array(
|
||||||
|
@ -32,7 +33,8 @@ class BlogHolder extends Page {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
$fields->removeFieldFromTab("Root.Content.Main","Content");
|
$fields->removeFieldFromTab("Root.Content.Main","Content");
|
||||||
$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar"));
|
$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar"));
|
||||||
|
$fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog"));
|
||||||
|
|
||||||
$fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array(
|
$fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array(
|
||||||
"" => "All entries",
|
"" => "All entries",
|
||||||
"1 MONTH" => "Last month's entries",
|
"1 MONTH" => "Last month's entries",
|
||||||
|
@ -260,9 +262,13 @@ class BlogHolder_Controller extends Page_Controller {
|
||||||
*/
|
*/
|
||||||
function rss() {
|
function rss() {
|
||||||
global $project;
|
global $project;
|
||||||
|
|
||||||
|
$blogName = $this->Name;
|
||||||
|
$altBlogName = $project . ' blog';
|
||||||
|
|
||||||
$children = $this->Children();
|
$children = $this->Children();
|
||||||
$children->sort('Date', 'DESC');
|
$children->sort('Date', 'DESC');
|
||||||
$rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "ParsedContent");
|
$rss = new RSSFeed($children, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent");
|
||||||
$rss->outputToBrowser();
|
$rss->outputToBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue