phmlabs/twigcontentbundle

There is no license information available for the latest version (dev-master) of this package.

include content from different sources

dev-master 2019-08-09 13:37 UTC

This package is auto-updated.

Last update: 2024-04-09 23:24:43 UTC


README

#TwigContentBundle

This twig tag extension helps to provide content snippets from different sources. It also provides a fallback case if no content retriever is defined.

Usage

{% content status_no_projects_yet %}
    This is the default text for the content snippet with the identifier status_no_projects_yet. 
    It will appear if the configured retriever does not return content.
{% endcontent %}

Content Retriever

Null Retriever

The null retriever returns the text defined inside the content block. The null retriever is the standard retriever and must not be configured.

Http Retriever

The http retriever can be used to fetch content via an http request.

# app/config/services.yml

services:
    phmlabs.content.retriever:
        class: phmLabs\TwigContentBundle\Retriever\HttpRetriever
        arguments: ["http://cms.example.com/#identifier#"]