Developers

Post

Whenever you're dealing with a post in your template, you're actually working with a Post object. As each provider returns different content, some attributes will return different content. However, the purpose of a Post object is to normalize the content from a provider.

You can access the raw content fetched from a provider's API using the data attribute.

Properties

id

Type: string|null

The ID of the post.

uid

Type: string|null

The unique or secondary identifer.

text

Type: string|null

The main text for the post.

url

Type: string|null

The URL to the post on the provider site.

sourceId

Type: int|null

The ID for the Source.

sourceHandle

Type: string|null

The handle for the Source.

sourceType

Type: string|null

The type of Source.

postType

Type: string|null

The type of post this is classified as.

likes

Type: int|null

The number of likes this post has received.

shares

Type: int|null

The number of shares this post has received.

replies

Type: int|null

The number of replies this post has received.

author

Type: verbb\socialfeeds\models\PostAuthor|null

The Post Author.

tags

Type: array

A collection of tags or hashtags for the post.

Type: array

A collection of Post Link objects.

images

Type: array

A collection of Post Media objects.

videos

Type: array

A collection of Post Media objects.

data

Type: array|null

A full response from the social media provider.

meta

Type: array|null

Any additional content for the post type for easy-access.

Methods

getSource()

Returns: string|null

Returns the source this post was made from.

getContent()

Returns: Twig\Markup

Returns text or message as the main content of the post.

hasMedia()

Returns: bool

Whether or not a post contains an image or video.

getAuthorImage()

Returns: array|null

Returns the author's profile image (if one exists).

getImage()

Returns: array|null

Returns the first image (typically the primary image) for the post.

getVideo()

Returns: array|null

Returns the first video (typically the primary video) for the post.

getFriendlyDate(date)

Returns: string

Returns a "friendly" representation of a date (e.g. 5.2M).

getProviderColor

The primary brand color of the provider connected.

getProviderIcon

The SVG icon of the source provider connected.

Post Author

Properties

id

Type: string|null

The ID of the author.

username

The username of the author.

name

The name of the author.

url

Type: string|null

The url of the author.

photo

The photo of the author.

Post Media

A media item represents either a video or an image.

Properties

id

Type: string|null

The ID of the media item.

title

Type: string|null

The title of the media item.

type

The type of media item (video or image).

url

Type: string|null

The url of the media item.

width

The width of the media item.

height

The height of the media item.

Post Link

Properties

id

Type: string|null

The ID of the link.

title

Type: string|null

The title of the link.

url

Type: string|null

The ID of the link.