\BlogPost
An indivisual blog post.
- Author: Michael Strong <github@michaelstrong.co.uk>
Synopsis
class BlogPost
extends Page
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $defaults = ;
- private static array $extensions = ;
- private static array $searchable_fields = ;
- private static array $summary_fields = ;
- private static array $allowed_children = ;
- private static string $default_sort = "PublishDate DESC";
- private static boolean $can_be_root = false;
- private static boolean $show_in_sitetree = false;
- // methods
- public void getCMSFields()
- public void onBeforeWrite()
- public void onBeforePublish()
- public boolean canView()
- public string Excerpt()
- public string getMonthlyArchiveLink()
- public string getYearlyArchiveLink()
- public array fieldLabels()
Hierarchy
Extends
- Page
Members
private
- $allowed_children
- $can_be_root
- $db
- $default_sort
- $defaults
- $extensions
- $has_one
- $many_many
- $searchable_fields
- $show_in_sitetree
—
boolean
This will display or hide the current class from the SiteTree. This variable can be configured using YAML. - $summary_fields
Methods
public
- Excerpt() — Returns the post excerpt.
- canView() — Checks the publish date to see if the blog post has actually been published.
- fieldLabels() — Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name')
- getCMSFields()
- getMonthlyArchiveLink() — Returns a monthly archive link for the current blog post.
- getYearlyArchiveLink() — Returns a yearly archive link for the current blog post.
- onBeforePublish() — Update the PublishDate to now, if being published for the first time, and the date hasn't been set to the future.
- onBeforeWrite() — If no publish date is set, set the date to now.