\Charcoal\Cms\Mixin\TraitsHasContentBlocksTrait

An implementation, as Trait, of the `HasContentBlocksInterface`.

Summary

Methods
Properties
Constants
contentBlocks()
hasContentBlocks()
numContentBlocks()
defaultMetaDescription()
attachments()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
metaDescFromAttachments()
ellipsis()
No private properties found
N/A

Methods

contentBlocks()

contentBlocks() : \Charcoal\Cms\Mixin\Traits\Collection|array<mixed,\Charcoal\Cms\Mixin\Traits\Attachment>

Retrieve this object's content blocks.

Returns

\Charcoal\Cms\Mixin\Traits\Collection|array<mixed,\Charcoal\Cms\Mixin\Traits\Attachment>

hasContentBlocks()

hasContentBlocks() : boolean

Determine if this object has any content blocks.

Returns

boolean

numContentBlocks()

numContentBlocks() : integer

Count the number of content blocks associated to this object.

Returns

integer

defaultMetaDescription()

defaultMetaDescription() : \Charcoal\Translator\Translation

Returns

\Charcoal\Translator\Translation

attachments()

attachments(string|null  $group = null, string|null  $type = null, callable|null  $callback = null) : \Charcoal\Cms\Mixin\Traits\Collection|array<mixed,\Charcoal\Cms\Mixin\Traits\Attachment>

Retrieve the objects associated to the current object.

As defined in Charcoal\Attachment\Traits\AttachmentAwareTrait.

Parameters

string|null $group

Filter the attachments by a group identifier.

string|null $type

Filter the attachments by type.

callable|null $callback

Optional routine to apply to every attachment.

Throws

\Charcoal\Cms\Mixin\Traits\InvalidArgumentException

If the $group or $type is invalid.

Returns

\Charcoal\Cms\Mixin\Traits\Collection|array<mixed,\Charcoal\Cms\Mixin\Traits\Attachment>

metaDescFromAttachments()

metaDescFromAttachments() : \Charcoal\Translator\Translation|null|string|array<mixed,\string>

Gets the content excerpt from attachments if a text attachment is found, otherwise it return null.

Returns

\Charcoal\Translator\Translation|null|string|array<mixed,\string> —

The content from attachment

ellipsis()

ellipsis(string|\Charcoal\Translator\Translation  $content, integer  $length = 200) : string|\Charcoal\Translator\Translation

Parameters

string|\Charcoal\Translator\Translation $content

The content to shorten.

integer $length

The length to shorten to. Default : 200.

Returns

string|\Charcoal\Translator\Translation