\Content\EventContentHook

Main Hook Listener for Content plugin.

Summary

Methods
Properties
Constants
implementedEvents()
renderContent()
renderBlock()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

implementedEvents()

implementedEvents() : void

Returns a list of hooks this Hook Listener is implementing. When the class is registered in an event manager, each individual method will be associated with the respective event.

renderContent()

renderContent(\Cake\Event\Event $event, \Content\Model\Entity\Content $content, array $options) : string

Renders a single Content Entity.

You can define specialized-renders according to your needs as follow. This method looks for specialized renders in the order described below, if one is not found we look the next one, etc.

Render content based on content-type & view-mode

 render_content_[content-type]_[view-mode].ctp

Renders the given content based on content-type + view-mode combination, for example:

  • render_content_article_full.ctp: Render for "article" contents in "full" view-mode.

  • render_content_article_search-result.ctp: Render for "article" contents in "search-result" view-mode.

  • render_content_basic-page_search-result.ctp: Render for "basic-page" contents in "search-result" view-mode.

Render content based on content-type

render_content_[content-type].ctp

Similar as before, but just based on content-type (and any view-mode), for example:

  • render_content_article.ctp: Render for "article" contents.

  • render_content_basic-page.ctp: Render for "basic-page" contents

Render content based on view-mode

render_content_[view-mode].ctp

Similar as before, but just based on view-mode (and any content-type), for example:

  • render_content_rss.ctp: Render any content (article, page, etc) in "rss" view-mode.

  • render_content_full.ctp: Render any content (article, page, etc) in "full" view-mode.

NOTE: To avoid collisions between view-mode names and content-type names, you should alway use unique and descriptive names as possible when defining new content types. By default, Content plugin defines the following view- modes: default, teaser, search-result, rss, full.

Default

render_content.ctp

This is the global render, if none of the above renders is found we try to use this last. Themes can overwrite this view element by creating a new one at ExampleTheme/Template/Element/render_content.ctp.


NOTE: Please note the difference between "_" and "-"

Parameters

\Cake\Event\Event $event

The event that was triggered

\Content\Model\Entity\Content $content

The content to render

array $options

Additional options as an array

Returns

string —

HTML

renderBlock()

renderBlock(\Cake\Event\Event $event, \Block\Model\Entity\Block $block, array $options) : string

Renders all blocks registered by Content plugin.

Content plugin has two built-in blocks that comes with every QuickApps CMS installation: "Recent Content" and "Search", both aimed to be placed on backend's dashboard regions.

Parameters

\Cake\Event\Event $event

The event that was triggered

\Block\Model\Entity\Block $block

The block being rendered

array $options

Additional options as an array

Returns

string