class BlogPost extends Page (View source)

An individual blog post.

Properties

string $PublishDate
string $AuthorNames
string $Summary
int $ParentID
int $FeaturedImageID

Methods

public
null|string
RoleOf(null|int|Member $member = null)

Determine the role of the given member.

public
bool
isAuthor(null|Member $member = null)

Determine if the given member is an author of this post.

public
getCMSFields()

{@inheritdoc}

public
getCandidateAuthors()

Gets the list of author candidates to be assigned as authors of this blog post.

public
bool
canEditAuthors(null|int|Member $member = null)

Determine if this user can edit the authors list.

protected
null|Member
getMember(null|int|Member $member = null)

No description

public
bool
canCreateCategories(null|int|Member $member = null)

Determine whether user can create new categories.

public
bool
canCreateTags(null|int|Member $member = null)

Determine whether user can create new tags.

public
onBeforePublish()

{@inheritdoc}

public
onAfterWrite()

{@inheritdoc}

public
canView($member = null)

{@inheritdoc}

public
canPublish($member = null)

{@inheritdoc}

public
canEdit($member = null)

{@inheritdoc}

public
string
Excerpt(int $wordsToDisplay = 30)

Returns the post excerpt.

public
string
getMonthlyArchiveLink(string $type = 'day')

Returns a monthly archive link for the current blog post.

public
string
getYearlyArchiveLink()

Returns a yearly archive link for the current blog post.

public
getCredits()

Resolves static and dynamic authors linked to this post.

protected
getDynamicCredits()

Resolves dynamic authors linked to this post.

protected
getStaticCredits()

Resolves static authors linked to this post.

public
bool
getProfilesDisabled()

Checks to see if User Profiles has been disabled via config

public
array
fieldLabels(bool $includeRelations = true)

Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name').

public
string|null
getDate()

Proxy method for displaying the publish date in rss feeds.

public
string
MinutesToRead(null|int $wpm = null)

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

protected
onBeforeWrite()

{@inheritdoc}

Categories()

No description

Tags()

No description

Authors()

No description

Parent()

No description

FeaturedImage()

No description

Details

null|string RoleOf(null|int|Member $member = null)

Determine the role of the given member.

Call be called via template to determine the current user.

Parameters

null|int|Member $member

Return Value

null|string

Examples

"Hello $RoleOf($CurrentMember.ID)"

bool isAuthor(null|Member $member = null)

Determine if the given member is an author of this post.

Parameters

null|Member $member

Return Value

bool

getCMSFields()

{@inheritdoc}

SS_List getCandidateAuthors()

Gets the list of author candidates to be assigned as authors of this blog post.

Return Value

SS_List

bool canEditAuthors(null|int|Member $member = null)

Determine if this user can edit the authors list.

Parameters

null|int|Member $member

Return Value

bool

protected null|Member getMember(null|int|Member $member = null)

No description

Parameters

null|int|Member $member

Return Value

null|Member

bool canCreateCategories(null|int|Member $member = null)

Determine whether user can create new categories.

Parameters

null|int|Member $member

Return Value

bool

bool canCreateTags(null|int|Member $member = null)

Determine whether user can create new tags.

Parameters

null|int|Member $member

Return Value

bool

onBeforePublish()

{@inheritdoc}

Update the PublishDate to now if the BlogPost would otherwise be published without a date.

onAfterWrite()

{@inheritdoc}

Sets blog relationship on all categories and tags assigned to this post.

canView($member = null)

{@inheritdoc}

Parameters

$member

canPublish($member = null)

{@inheritdoc}

Parameters

$member

canEdit($member = null)

{@inheritdoc}

Parameters

$member

string Excerpt(int $wordsToDisplay = 30)

Returns the post excerpt.

Parameters

int $wordsToDisplay

Return Value

string

Returns a monthly archive link for the current blog post.

Parameters

string $type

Return Value

string

Returns a yearly archive link for the current blog post.

Return Value

string

ArrayList getCredits()

Resolves static and dynamic authors linked to this post.

Return Value

ArrayList

protected ArrayList getDynamicCredits()

Resolves dynamic authors linked to this post.

Return Value

ArrayList

protected ArrayList getStaticCredits()

Resolves static authors linked to this post.

Return Value

ArrayList

bool getProfilesDisabled()

Checks to see if User Profiles has been disabled via config

Return Value

bool

array fieldLabels(bool $includeRelations = true)

Sets the label for BlogPost.Title to 'Post Title' (Rather than 'Page name').

Parameters

bool $includeRelations

Return Value

array

string|null getDate()

Proxy method for displaying the publish date in rss feeds.

string MinutesToRead(null|int $wpm = null)

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

Parameters

null|int $wpm

Return Value

string

protected onBeforeWrite()

{@inheritdoc}

ManyManyList Categories()

No description

Return Value

ManyManyList

ManyManyList Tags()

No description

Return Value

ManyManyList

ManyManyList Authors()

No description

Return Value

ManyManyList

Blog Parent()

No description

Return Value

Blog

Image FeaturedImage()

No description

Return Value

Image