mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
ENHANCEMENT: make blog module independent of widget module
This commit is contained in:
parent
5a21b4eeb9
commit
efb1264926
@ -4,4 +4,6 @@ Director::addRules(10, array(
|
|||||||
'metaweblog' => 'MetaWeblogController'
|
'metaweblog' => 'MetaWeblogController'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if(class_exists('WidgetArea')) DataExtension::add_to_class('BlogTree','BlogTreeExtension');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -111,6 +111,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
$blogholder->URLSegment = "blog";
|
$blogholder->URLSegment = "blog";
|
||||||
$blogholder->Status = "Published";
|
$blogholder->Status = "Published";
|
||||||
|
|
||||||
|
if(class_exists('WidgetArea')) {
|
||||||
$widgetarea = new WidgetArea();
|
$widgetarea = new WidgetArea();
|
||||||
$widgetarea->write();
|
$widgetarea->write();
|
||||||
|
|
||||||
@ -131,6 +132,11 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
$archivewidget->write();
|
$archivewidget->write();
|
||||||
|
|
||||||
$widgetarea->write();
|
$widgetarea->write();
|
||||||
|
} else {
|
||||||
|
$blogholder->write();
|
||||||
|
$blogholder->publish("Stage", "Live");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$blog = new BlogEntry();
|
$blog = new BlogEntry();
|
||||||
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
|
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
|
||||||
|
@ -23,9 +23,9 @@ class BlogTree extends Page {
|
|||||||
'InheritSideBar' => True
|
'InheritSideBar' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
static $has_one = array(
|
static $has_one = array();
|
||||||
"SideBar" => "WidgetArea",
|
|
||||||
);
|
static $has_many = array();
|
||||||
|
|
||||||
static $allowed_children = array(
|
static $allowed_children = array(
|
||||||
'BlogTree', 'BlogHolder'
|
'BlogTree', 'BlogHolder'
|
||||||
@ -113,9 +113,11 @@ class BlogTree extends Page {
|
|||||||
"12 MONTH" => "Last year's entries",
|
"12 MONTH" => "Last year's entries",
|
||||||
"INHERIT" => "Take value from parent Blog Tree"
|
"INHERIT" => "Take value from parent Blog Tree"
|
||||||
)));
|
)));
|
||||||
|
if(class_exists('WidgetArea')) {
|
||||||
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
||||||
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
|
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
7
code/widgets/BlogTreeExtension.php
Normal file
7
code/widgets/BlogTreeExtension.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class BlogTreeExtension extends DataExtension {
|
||||||
|
|
||||||
|
static $has_one = array("SideBar" => "WidgetArea");
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user