diff --git a/code/extensions/BlogFeatureExtension.php b/code/extensions/BlogFeatureExtension.php deleted file mode 100644 index cbd076f..0000000 --- a/code/extensions/BlogFeatureExtension.php +++ /dev/null @@ -1,41 +0,0 @@ -filter('ParentID', $this->owner->ID) - ->filter('IsFeatured', true); - } - - /** - * @param DataList $posts - * @param null|string $context Context for these blog posts (e.g 'rss') - * - * @return DataList - */ - public function updateGetBlogPosts(DataList &$posts, $context = null) { - if($context === 'rss') { - return; - } - - $excluded = (int) Config::inst()->get('BlogFeatureExtension', 'excluded_feature_posts'); - - if($excluded > 0) { - $taken = $this->getFeaturedBlogPosts()->limit($excluded); - - if ($taken->count()) { - $posts = $posts->exclude(array('ID' => $taken->getIDList())); - } - } - } -} diff --git a/code/extensions/BlogPostFeatureExtension.php b/code/extensions/BlogPostFeatureExtension.php deleted file mode 100644 index 99d1593..0000000 --- a/code/extensions/BlogPostFeatureExtension.php +++ /dev/null @@ -1,21 +0,0 @@ - 'Boolean', - ); - - /** - * @inheritdoc - * - * @param FieldList - */ - public function updateCMSFields(FieldList $fields) { - $sidebar = $fields->fieldByName('blog-admin-sidebar'); - - $sidebar->insertBefore('PublishDate', new CheckboxField('IsFeatured', 'Mark as featured post')); - } -} diff --git a/code/model/Blog.php b/code/model/Blog.php index e3da896..ebfd1f7 100644 --- a/code/model/Blog.php +++ b/code/model/Blog.php @@ -471,14 +471,12 @@ class Blog extends Page implements PermissionProvider { /** * Return blog posts. * - * @param null|string $context Context for these blog posts (e.g 'rss') - * * @return DataList of BlogPost objects */ - public function getBlogPosts($context = null) { + public function getBlogPosts() { $blogPosts = BlogPost::get()->filter('ParentID', $this->ID); - $this->extend('updateGetBlogPosts', $blogPosts, $context); + $this->extend('updateGetBlogPosts', $blogPosts); return $blogPosts; } @@ -997,7 +995,7 @@ class Blog_Controller extends Page_Controller { */ $dataRecord = $this->dataRecord; - $this->blogPosts = $dataRecord->getBlogPosts('rss'); + $this->blogPosts = $dataRecord->getBlogPosts(); $rss = new RSSFeed($this->blogPosts, $this->Link(), $this->MetaTitle, $this->MetaDescription); diff --git a/code/model/BlogCategory.php b/code/model/BlogCategory.php index a04f712..d8a1fe4 100644 --- a/code/model/BlogCategory.php +++ b/code/model/BlogCategory.php @@ -7,7 +7,6 @@ * @subpackage blog * * @method Blog Blog() - * @method ManyManyList BlogPosts() * * @property string $URLSegment * @property int $BlogID diff --git a/code/model/BlogTag.php b/code/model/BlogTag.php index b1ff547..d9f0aac 100644 --- a/code/model/BlogTag.php +++ b/code/model/BlogTag.php @@ -7,7 +7,6 @@ * @subpackage blog * * @method Blog Blog() - * @method ManyManyList BlogPosts * * @property string $Title * @property string $URLSegment diff --git a/docs/en/_images/featured-posts-cms.png b/docs/en/_images/featured-posts-cms.png deleted file mode 100644 index fa3b5d0..0000000 Binary files a/docs/en/_images/featured-posts-cms.png and /dev/null differ diff --git a/docs/en/featured-posts.md b/docs/en/featured-posts.md deleted file mode 100644 index e7bea76..0000000 --- a/docs/en/featured-posts.md +++ /dev/null @@ -1,38 +0,0 @@ -# Featured posts - -You can enable featured posts with the following config: - -```yaml ---- -Name: featured-posts-blog-config ---- -Blog: - extensions: - - BlogFeatureExtension - -BlogPost: - extensions: - - BlogPostFeatureExtension -``` - -This will enable a checkbox in the CMS, with which you can feature blog posts: - -![](_images/featured-posts-cms.png) - -By default, the template will show the most recent featured post at the top of the -list of posts in a blog. This post will be removed from the normal list of blog posts. -You can increase the number of specially-displayed feature posts by modifying the -template to show more, and by changing the following config setting: - -``` -<% if $CanHaveFeaturedBlogPosts && $FeaturedBlogPosts %> - <% loop $FeaturedBlogPosts.Limit(10) %> - <% include FeaturedPostSummary %> - <% end_loop %> -<% end_if %> -``` - -```yaml -BlogFeatureExtension: - excluded_feature_posts: 10 -``` diff --git a/templates/Includes/FeaturedPostSummary.ss b/templates/Includes/FeaturedPostSummary.ss deleted file mode 100644 index 7ca2725..0000000 --- a/templates/Includes/FeaturedPostSummary.ss +++ /dev/null @@ -1,26 +0,0 @@ -
-

- "> - <% if $MenuTitle %>$MenuTitle - <% else %>$Title<% end_if %> - -

- -

- > - $FeaturedImage.setWidth(795) - -

- - <% if $Summary %> -

$Summary - <% else %> -

$Excerpt - <% end_if %> - - <%t Blog.ReadMoreAbout "Read more about '{title}'..." title=$Title %> - -

- - <% include EntryMeta %> -
diff --git a/templates/Layout/Blog.ss b/templates/Layout/Blog.ss index 5cccf67..5a29c3b 100644 --- a/templates/Layout/Blog.ss +++ b/templates/Layout/Blog.ss @@ -24,21 +24,12 @@
$Content
- <% if $FeaturedBlogPosts.Exists && $FeaturedBlogPosts.First %> - <% with $FeaturedBlogPosts.First %> - <% include FeaturedPostSummary %> - <% end_with %> - <% end_if %> <% if $PaginatedList.Exists %> <% loop $PaginatedList %> <% include PostSummary %> <% end_loop %> <% else %> - <% if $FeaturedBlogPosts.Exists %> -

<%t Blog.NoUnfeaturedPosts 'There are no non-featured posts' %>

- <% else %> -

<%t Blog.NoPosts 'There are no posts' %>

- <% end_if %> +

<%t Blog.NoPosts 'There are no posts' %>

<% end_if %>