API Remove widgets

This commit is contained in:
Steve Boyd 2024-08-21 09:39:04 +12:00
parent 9768b273f5
commit 1bdb661705
9 changed files with 3 additions and 81 deletions

View File

@ -10,7 +10,6 @@
### Suggested Modules ### Suggested Modules
* Silverstripe Widgets Module
* Silverstripe Comments Module * Silverstripe Comments Module
## Installation ## Installation

View File

@ -4,12 +4,3 @@ Name: blogconfig
SilverStripe\Security\Member: SilverStripe\Security\Member:
extensions: extensions:
- SilverStripe\Blog\Model\BlogMemberExtension - SilverStripe\Blog\Model\BlogMemberExtension
---
Name: featuredpostswidget
Only:
moduleexists: silverstripe/widgets
---
SilverStripe\Blog\Model\BlogPost:
extensions:
- SilverStripe\Blog\Model\BlogPostFeaturedExtension

View File

@ -1,18 +0,0 @@
# Configuring Widgets
The blog module comes bundled with some useful widgets. To take advantage of them, you'll need to install the
[SilverStripe widgets module](https://github.com/silverstripe/silverstripe-widgets). Widgets are totally optional -
so your blog will work just fine without having widgets installed.
You can enable the widgets by adding the following YML config:
```yaml
SilverStripe\Blog\Model\Blog:
extensions:
- SilverStripe\Widgets\Extensions\WidgetPageExtension
SilverStripe\Blog\Model\BlogPost:
extensions:
- SilverStripe\Widgets\Extensions\WidgetPageExtension
```
Once you have widgets installed you'll see the "Widgets" tab in the content section of your blog.

View File

@ -3,7 +3,6 @@
## Development ## Development
* [Configuring blog posts in Sitetree](configuring-blog-posts.md) * [Configuring blog posts in Sitetree](configuring-blog-posts.md)
* [Configuring blog when on large websites](configuring-large-websites.md) * [Configuring blog when on large websites](configuring-large-websites.md)
* [Configuring widgets](configuring-widgets.md)
* [Configuring pagination](configuring-pagination.md) * [Configuring pagination](configuring-pagination.md)
* [Configuring featured image uploads](configuring-featured-images.md) * [Configuring featured image uploads](configuring-featured-images.md)

View File

@ -6,7 +6,7 @@ summary: Working with blogging and comments in SilverStripe CMS.
## Before we begin ## Before we begin
Make sure that your SilverStripe CMS installation has the [Blog](https://addons.silverstripe.org/add-ons/silverstripe/blog/) module and optional, [Widgets](https://addons.silverstripe.org/add-ons/silverstripe/widgets/) and [Comments](https://addons.silverstripe.org/add-ons/silverstripe/comments/) modules installed. Make sure that your SilverStripe CMS installation has the [Blog](https://addons.silverstripe.org/add-ons/silverstripe/blog/) module and optional, and [Comments](https://addons.silverstripe.org/add-ons/silverstripe/comments/) modules installed.
## Blogging features ## Blogging features
@ -16,5 +16,4 @@ Make sure that your SilverStripe CMS installation has the [Blog](https://addons.
* [Roles](roles.md) * [Roles](roles.md)
* [RSS Feed](rss-feed.md) * [RSS Feed](rss-feed.md)
* [Tags and categories](tags-and-categories.md) * [Tags and categories](tags-and-categories.md)
* [Using widgets](using-widgets.md)
* [Managing comments](managing-comments.md) * [Managing comments](managing-comments.md)

View File

@ -1,48 +0,0 @@
---
title: Using widgets
---
# Using Widgets
**This guide assumes you have the optional [Widgets](https://addons.silverstripe.org/add-ons/silverstripe/widgets/) module installed**
![](_images/widgets.png)
To add a widget - simply click the *plus* icon and the widget will be appear in the "Widgets currently used" column.
After you've finished adding widgets, publish your blog, and your freshly minted widgets will appear in your blog's sidebar.
## Available blog widgets
### Archive
The archive widget helps you keep historical content relevant, by generating a list of posts, ordered by month or year.
![](_images/widgets-archive.png)
### Blog Categories
The blog categories widget lets your readers easily find the content they're interested in.
![](_images/widgets-categories.png)
### Recent Posts
The recent posts widget is great for providing quick links to your latest content.
![](_images/widgets-recent-posts.png)
### Blog Tags
Similar to the blog categories widget, blog tags help your readers find relevant content, at more fine grained level.
![](_images/widgets-tags.png)
## Optional extra widgets
Additional widgets can be installed alongside your blog.
* [Content Widget - Display HTML content in a widget](https://github.com/silverstripe-labs/silverstripe-content-widget)

View File

@ -86,6 +86,7 @@ class BlogCategory extends DataObject implements CategorisationObject
$parent = ($ownerRecord instanceof SiteTree) ? $ownerRecord->Parent() : null; $parent = ($ownerRecord instanceof SiteTree) ? $ownerRecord->Parent() : null;
$field = TagField::create( $field = TagField::create(
$relationName, $relationName,
/** @phpstan-ignore translation.key (we need the key to be dynamic here) */
_t($ownerRecord->ClassName . '.' . $relationName, $fieldTitle), _t($ownerRecord->ClassName . '.' . $relationName, $fieldTitle),
($parent instanceof Blog) ? $parent->Categories() : static::get(), ($parent instanceof Blog) ? $parent->Categories() : static::get(),
$ownerRecord->$relationName() $ownerRecord->$relationName()

View File

@ -106,13 +106,11 @@ class BlogPost extends Page
/** /**
* The ProvideComments db column is defined in the silverstripe/comments module * The ProvideComments db column is defined in the silverstripe/comments module
* The InheritSideBar db column is defined in the silverstripe/widgets module
* *
* @var array * @var array
*/ */
private static $defaults = [ private static $defaults = [
'ShowInMenus' => false, 'ShowInMenus' => false,
'InheritSideBar' => true,
'ProvideComments' => true 'ProvideComments' => true
]; ];

View File

@ -86,6 +86,7 @@ class BlogTag extends DataObject implements CategorisationObject
$parent = ($ownerRecord instanceof SiteTree) ? $ownerRecord->Parent() : null; $parent = ($ownerRecord instanceof SiteTree) ? $ownerRecord->Parent() : null;
$field = TagField::create( $field = TagField::create(
$relationName, $relationName,
/** @phpstan-ignore translation.key (we need the key to be dynamic here) */
_t($ownerRecord->ClassName . '.' . $relationName, $fieldTitle), _t($ownerRecord->ClassName . '.' . $relationName, $fieldTitle),
($parent instanceof Blog) ? $parent->Tags() : static::get(), ($parent instanceof Blog) ? $parent->Tags() : static::get(),
$ownerRecord->$relationName() $ownerRecord->$relationName()