mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
NEW Making widgets dependency optional
This commit is contained in:
parent
966d168119
commit
ee532292d2
@ -14,7 +14,7 @@ The blog module allows you to post blogs on your SilverStripe. It includes the a
|
||||
## Requirements
|
||||
|
||||
* Silverstripe 3.0
|
||||
* silverstripe-widgets module
|
||||
* (Optional) silverstripe-widgets module
|
||||
|
||||
## Feature Overview
|
||||
|
||||
@ -76,10 +76,6 @@ or: mysite/blog/2007 would show blog entries for 2007
|
||||
|
||||
See [:pagecomment](/pagecomment) for creating Askimet-protected comments for every page.
|
||||
|
||||
## Widgets
|
||||
|
||||
See [widgets](/widgets)
|
||||
|
||||
|
||||
## Working with the theme
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
if(class_exists('Widget')) {
|
||||
/**
|
||||
* Shows a widget with viewing blog entries
|
||||
* by months or years.
|
||||
*
|
||||
* @package blog
|
||||
*/
|
||||
class ArchiveWidget extends Widget {
|
||||
class ArchiveWidget extends Widget {
|
||||
static $db = array(
|
||||
'DisplayMode' => 'Varchar'
|
||||
);
|
||||
@ -106,6 +107,6 @@ class ArchiveWidget extends Widget {
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
if(class_exists('Widget')) {
|
||||
|
||||
/**
|
||||
* Blog Management Widget
|
||||
* @package blog
|
||||
*/
|
||||
class BlogManagementWidget extends Widget implements PermissionProvider {
|
||||
class BlogManagementWidget extends Widget {
|
||||
static $db = array();
|
||||
|
||||
static $has_one = array();
|
||||
@ -45,13 +47,9 @@ class BlogManagementWidget extends Widget implements PermissionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
function providePermissions() {
|
||||
return array("BLOGMANAGEMENT" => "Blog management");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class BlogManagementWidget_Controller extends Widget_Controller {
|
||||
class BlogManagementWidget_Controller extends Widget_Controller {
|
||||
|
||||
function WidgetHolder() {
|
||||
if(Permission::check("BLOGMANAGEMENT")) {
|
||||
@ -63,5 +61,6 @@ class BlogManagementWidget_Controller extends Widget_Controller {
|
||||
$container = BlogTree::current();
|
||||
return ($container && $container->ClassName != "BlogTree") ? $container->Link('post') : false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class RSSWidget extends Widget {
|
||||
if(class_exists('Widget')) {
|
||||
class RSSWidget extends Widget {
|
||||
static $db = array(
|
||||
"RSSTitle" => "Text",
|
||||
"RssUrl" => "Text",
|
||||
@ -91,6 +91,6 @@ class RSSWidget extends Widget {
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
if(class_exists('Widget')) {
|
||||
/**
|
||||
* A simple widget that just shows a link
|
||||
* to this website's blog RSS, with an RSS
|
||||
* icon.
|
||||
*
|
||||
* @package blog
|
||||
*/
|
||||
class SubscribeRSSWidget extends Widget {
|
||||
class SubscribeRSSWidget extends Widget {
|
||||
|
||||
static $title = 'Subscribe via RSS';
|
||||
|
||||
@ -26,6 +26,6 @@ class SubscribeRSSWidget extends Widget {
|
||||
$container = BlogTree::current();
|
||||
if ($container) return $container->Link('rss');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
@ -14,9 +14,10 @@
|
||||
}
|
||||
],
|
||||
|
||||
"require":
|
||||
{
|
||||
"silverstripe/cms": "3.0.*",
|
||||
"require": {
|
||||
"silverstripe/cms": "3.0.*"
|
||||
},
|
||||
"suggests": {
|
||||
"silverstripe/widgets": "0.1.*"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user