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'
|
||||
));
|
||||
|
||||
if(class_exists('WidgetArea')) DataExtension::add_to_class('BlogTree','BlogTreeExtension');
|
||||
|
||||
?>
|
||||
|
@ -111,26 +111,32 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
||||
$blogholder->URLSegment = "blog";
|
||||
$blogholder->Status = "Published";
|
||||
|
||||
$widgetarea = new WidgetArea();
|
||||
$widgetarea->write();
|
||||
if(class_exists('WidgetArea')) {
|
||||
$widgetarea = new WidgetArea();
|
||||
$widgetarea->write();
|
||||
|
||||
$blogholder->SideBarID = $widgetarea->ID;
|
||||
$blogholder->write();
|
||||
$blogholder->publish("Stage", "Live");
|
||||
$blogholder->SideBarID = $widgetarea->ID;
|
||||
$blogholder->write();
|
||||
$blogholder->publish("Stage", "Live");
|
||||
|
||||
$managementwidget = new BlogManagementWidget();
|
||||
$managementwidget->ParentID = $widgetarea->ID;
|
||||
$managementwidget->write();
|
||||
$managementwidget = new BlogManagementWidget();
|
||||
$managementwidget->ParentID = $widgetarea->ID;
|
||||
$managementwidget->write();
|
||||
|
||||
$tagcloudwidget = new TagCloudWidget();
|
||||
$tagcloudwidget->ParentID = $widgetarea->ID;
|
||||
$tagcloudwidget->write();
|
||||
$tagcloudwidget = new TagCloudWidget();
|
||||
$tagcloudwidget->ParentID = $widgetarea->ID;
|
||||
$tagcloudwidget->write();
|
||||
|
||||
$archivewidget = new ArchiveWidget();
|
||||
$archivewidget->ParentID = $widgetarea->ID;
|
||||
$archivewidget->write();
|
||||
$archivewidget = new ArchiveWidget();
|
||||
$archivewidget->ParentID = $widgetarea->ID;
|
||||
$archivewidget->write();
|
||||
|
||||
$widgetarea->write();
|
||||
$widgetarea->write();
|
||||
} else {
|
||||
$blogholder->write();
|
||||
$blogholder->publish("Stage", "Live");
|
||||
}
|
||||
|
||||
|
||||
$blog = new BlogEntry();
|
||||
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
|
||||
|
@ -23,9 +23,9 @@ class BlogTree extends Page {
|
||||
'InheritSideBar' => True
|
||||
);
|
||||
|
||||
static $has_one = array(
|
||||
"SideBar" => "WidgetArea",
|
||||
);
|
||||
static $has_one = array();
|
||||
|
||||
static $has_many = array();
|
||||
|
||||
static $allowed_children = array(
|
||||
'BlogTree', 'BlogHolder'
|
||||
@ -113,9 +113,11 @@ class BlogTree extends Page {
|
||||
"12 MONTH" => "Last year's entries",
|
||||
"INHERIT" => "Take value from parent Blog Tree"
|
||||
)));
|
||||
|
||||
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
||||
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
|
||||
if(class_exists('WidgetArea')) {
|
||||
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
||||
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
|
||||
}
|
||||
|
||||
|
||||
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