trait BlogObject (View source)

An object shared by BlogTag and BlogCategory.

Methods

public
BlogPosts(int|array|null $id = null)

No description

public
getCMSFields()

{@inheritdoc}

public
validate()

{@inheritdoc}

public
string
getLink()

Returns a relative link to this category.

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

Inherits from the parent blog or can be overwritten using a DataExtension.

public
canCreate($member = null, $context = [])

{@inheritdoc}

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

Inherits from the parent blog or can be overwritten using a DataExtension.

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

Inherits from the parent blog or can be overwritten using a DataExtension.

protected
onBeforeWrite()

{@inheritdoc}

public
string
generateURLSegment(int $increment = 0)

Generates a unique URLSegment from the title.

protected
getDuplicatesByField(string $field)

Looks for objects o the same type and the same value by the given Field

protected
string
getListUrlSegment()

This returns the url segment for the listing page.

protected
string
getDuplicateError()

Returns an error message for this object when it tries to write a duplicate.

Details

DataList BlogPosts(int|array|null $id = null)

No description

Parameters

int|array|null $id

Optional ID(s) for parent of this relation, if not the current record

Return Value

DataList

getCMSFields()

{@inheritdoc}

ValidationResult validate()

{@inheritdoc}

Return Value

ValidationResult

Returns a relative link to this category.

Return Value

string

bool canView(null|Member $member = null)

Inherits from the parent blog or can be overwritten using a DataExtension.

Parameters

null|Member $member

Return Value

bool

canCreate($member = null, $context = [])

{@inheritdoc}

Parameters

$member
$context

bool canDelete(null|Member $member = null)

Inherits from the parent blog or can be overwritten using a DataExtension.

Parameters

null|Member $member

Return Value

bool

bool canEdit(null|Member $member = null)

Inherits from the parent blog or can be overwritten using a DataExtension.

Parameters

null|Member $member

Return Value

bool

protected onBeforeWrite()

{@inheritdoc}

string generateURLSegment(int $increment = 0)

Generates a unique URLSegment from the title.

Parameters

int $increment

Return Value

string

protected DataList getDuplicatesByField(string $field)

Looks for objects o the same type and the same value by the given Field

Parameters

string $field

E.g. URLSegment or Title

Return Value

DataList

abstract protected string getListUrlSegment()

This returns the url segment for the listing page.

eg. 'categories' in /my-blog/categories/category-url

This is not editable at the moment, but a method is being used incase we want to make it editable in the future. We can use this method to provide logic without replacing multiple areas of the code base. We're also not being opinionated about how the segment should be obtained at the moment and allowing for the implementation to decide.

Return Value

string

abstract protected string getDuplicateError()

Returns an error message for this object when it tries to write a duplicate.

Return Value

string