SilverStripe\Blog\Model\BlogPost
An individual blog post.
Synopsis
class BlogPost
extends Page
{
- // members
- private static string|bool $restrict_authors_to_group = false;
- private static string $table_name = 'BlogPost';
- private static string $icon_class = 'font-icon-p-post';
- private static array $db = ;
- private static array $indexes = ;
- private static array $has_one = ;
- private static array $owns = ;
- 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 $casting = ;
- private static array $allowed_children = ;
- private static string $default_sort = '"PublishDate" IS NULL DESC, "PublishDate" DESC';
- private static bool $can_be_root = false;
- private static bool $show_in_sitetree = false;
- private static integer $minutes_to_read_wpm = 200;
- private static $featured_images_directory = NULL;
- // methods
- public null|string RoleOf()
- public bool isAuthor()
- public void getCMSFields()
- public SS_List getCandidateAuthors()
- public bool canEditAuthors()
- protected null|Member getMember()
- public bool canCreateCategories()
- public bool canCreateTags()
- public void onBeforePublish()
- public void onAfterWrite()
- public void canView()
- public void canPublish()
- public void canEdit()
- public string Excerpt()
- public string getMonthlyArchiveLink()
- public string getYearlyArchiveLink()
- public ArrayList getCredits()
- protected ArrayList getDynamicCredits()
- protected ArrayList getStaticCredits()
- public bool getProfilesDisabled()
- public array fieldLabels()
- public string|null getDate()
- public string MinutesToRead()
- protected void onBeforeWrite()
Hierarchy
Extends
- Page
Members
private
- $allowed_children — array
- $can_be_root — SilverStripe\Blog\Model\bool
- $casting — array
- $db — array
- $default_sort
—
string
The default sorting lists BlogPosts with an empty PublishDate at the top. - $defaults
—
array
The ProvideComments db column is defined in the silverstripe/comments module The InheritSideBar db column is defined in the silverstripe/widgets module - $extensions — array
- $featured_images_directory
—
string
Sets the upload directory for featured images to help keep your files organised - $has_one — array
- $icon_class — string
- $indexes — array
- $many_many — array
- $minutes_to_read_wpm
—
int
This helps estimate how long an article will take to read, if your target audience is elderly then you should lower this value. See {@link getMinutesToRead()} - $owns — array
- $searchable_fields — array
- $show_in_sitetree
—
SilverStripe\Blog\Model\bool
This will display or hide the current class from the SiteTree. This variable can be configured using YAML. - $summary_fields — array
- $table_name
—
string
{@inheritDoc}
Methods
protected
- getDynamicCredits() — Resolves dynamic authors linked to this post.
- getMember()
- getStaticCredits() — Resolves static authors linked to this post.
- onBeforeWrite() — {@inheritdoc}
public
- Excerpt() — Returns the post excerpt.
- MinutesToRead() — Provides a rough estimate of how long this post will take to read based on wikipedias answer to "How fast can a human read" of 200wpm. Source https://en.wikipedia.org/wiki/Speed_reading
- RoleOf() — Determine the role of the given member.
- canCreateCategories() — Determine whether user can create new categories.
- canCreateTags() — Determine whether user can create new tags.
- canEdit() — {@inheritdoc}
- canEditAuthors() — Determine if this user can edit the authors list.
- canPublish() — {@inheritdoc}
- canView() — {@inheritdoc}
- fieldLabels() — Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name').
- getCMSFields() — {@inheritdoc}
- getCandidateAuthors() — Gets the list of author candidates to be assigned as authors of this blog post.
- getCredits() — Resolves static and dynamic authors linked to this post.
- getDate() — Proxy method for displaying the publish date in rss feeds.
- getMonthlyArchiveLink() — Returns a monthly archive link for the current blog post.
- getProfilesDisabled() — Checks to see if User Profiles has been disabled via config
- getYearlyArchiveLink() — Returns a yearly archive link for the current blog post.
- isAuthor() — Determine if the given member is an author of this post.
- onAfterWrite() — {@inheritdoc}
- onBeforePublish() — {@inheritdoc}