Mity Docs Mity Docs for Mity Digital
Feedamic Documentation

Feedamic Entry

Feedamic 2 had an interface that allowed you to create your own Feedamic-compatible models. With Feedamic 3, we wanted to do a lot of the heavy lifting for you: and have changed from a contract to an Abstract class.

Feedamic ships with its own MityDigital\Feedamic\Models\FeedamicEntry model that is all ready to go.

All of the intelligence of this class is in an Abstract class - MityDigital\Feedamic\Abstracts\AbstractFeedamicEntry. You are free to create your own Feedamic Entry model, however you must extend this class.

Create

Creating a new Model requires a Statamic Entry (Statamic\Entries\Entry), and a FeedamicConfig object. This will allow all of the intelligence inside to know what Feed it belongs to, as well as have access to the original Entry.

Your own Feedamic Entry must use this same signature.

Public methods

These fields do the heavy lifting for you including:

If you extend the FeedamicEntry class, feel free to do whatever you need to do: but there is a lot of smarts here to help you out.

author

Returns the configured Author, if configured.

Otherwise, returns null.

This only returns a related Entry/User, or field-based Author: the fallback Author Name/Email are handled in the views directly.

config

Returns the FeedamicConfig object.

content

Returns the Entry's content, following your Feed's configuration cascade.

May be null.

entry

Returns the underlying Statamic Entry.

hasAuthor

Returns true when an Author is configured, or false otherwise.

hasContent

Returns true when content is configured, or false otherwise.

hasImage

Returns true when an image is configured, or false otherwise.

hasSummary

Returns true when summary content is configured, or false otherwise.

image

Returns the Entry's image, following your Feed's configuration cascade.

If your image field allows multiple assets, only the first is returned.

May be null.

summary

Returns the Entry's summary, following your Feed's configuration cascade.

May be null.

title

Returns the Entry's title, following your Feed's configuration cascade.

url

Returns the Entry's URL.

Helper methods

encode

Encodes a string using htmlspecialchars and getting ready for markup use in XML.

isHtml

Returns true if the input is HTML, or false otherwise.

Accessing the Entry

Calls to the underlying Entry are forwarded - for both method calls and properties.

For example, accessing the Entry's site method is as simple as:

1$feedamicEntry->site();

If the property you're trying to access is actually part of the Feedamic Entry too, you might need to access the Entry first:

1$feedamicEntry->title; // the FeedamicEntry title
2 
3$feedamicEntry->entry()->title; // the Statamic Entry title