Download the PHP package heimrichhannot/contao-reader-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-reader-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package contao-reader-bundle

Contao Reader Bundle

Build Status Coverage Status

This bundle offers a generic reader module to use with arbitrary contao entities containing standard reader specific functionality like field output, images and auto_item handling.

It makes it possible to generate readers not only for events, news or faq's but with every DCA you like.

Features

Hint: This module can greatly be used with heimrichhannot/contao-list-bundle which can display lists of arbitrary DCA entities

Impressions

Reader configuration

Concepts

Inheritable reader configuration

Since reader configuration can be lots of data sometimes we decided to outsource it into a dedicated DCA entity. These entities can be assigned to one or even multiple reader modules in a reusable way.

In addition it's possible to create reader configs that inherit from other reader configs. Hence overriding a single option while keeping everything else is possible.

The Item class

Every database record output in a reader (e.g. an event) is modelled and wrapped by the Item class. The concrete class is DefaultItem. You can imagine the item as a kind of ORM (object-relational-mapping).

The most important properties of an item are the arrays raw and formatted which also can be iterated in the reader item template:

Example: Let's say a database record has a field startDate which holds a unix timestamp of the date chosen in the backend. Then raw contains this unix timestamp and formatted contains the pretty printed date according to the dateFormat set in the contao settings, i.e. "2020-09-12".

The reader bundle uses the method FormUtil::prepareSpecialValueForOutput() in heimrichhannot/contao-utils-bundle for handling special values. It supports a wide range of types of special values:

You can access both of these arrays in your reader item twig template as you normally would in twig:

CAUTION: By default all values of a database record are formatted and accessible in the item template. As you can imagine if some of the fields have thousands of options, the process of formatting can take some time and can reduce the peformance of your website. Hence you always should limit the formatted fields and only format these you really need. You can adjust that in the reader configuration (field limitFormattedFields).

For convenience reasons you can also access the field values like so in your twig template:

If you configured the field fieldname to be formatted, it will contain the formatted value. If not, the raw one. If it's formatted, you can still access its raw value by using:

Reader config elements

Every reader config can have one or more reader config elements. These are designed to specify things that can occur multiple times (e.g. because there are many fields of one type).

Currently build-in reader config element types:

Type Description
image Configure the output of one or more image fields separately (image size, placeholder handling, ...)
tags Output one or more tag fields based on codefog/tags-bundle.
related items Output related items based on given tags (needs heimrichhannot/contao-list-bundle; needs codefog/tags-bundle) or categories (needs heimrichhannot/contao-categories-bundle).

Other bundle can add reader config elements as well. Some examples:

Image

You can add images either as formatted value of, if you also like to have additional features like image size processing or automatic placeholders if no image is set, you can use the image reader config element.

After the configuration you can output it as follows in your item template:

IMPORTANT: Note that by default the generated picture elements are added to an array called images. If your DCA contains a field with the same name, you need to specify a different container name like e.g. resizedImages (using overrideTemplateContainerVariable).

Templates

There are two ways to define your templates.

1. By Prefix

The first one is to simply deploy twig templates inside any templates or bundles views directory with the following prefixes:

More prefixes can be defined, see 2nd way.

2. By config.yml

The second on is to extend the config.yml and define a strict template:

Plugin.php

config.yml

Developers

Events

Class Name Description
RenderTwigTemplateEvent huh.utils.template.render Will be fired before the reader item is rendered (in DefaultItem). If you've overriden the parse method in an custom item class, you need to implement the event dispatcher by yourself. The event is located in Utils Bundle and used here for better bundle interoperability.

Reader config elements

It is easy to add new reader config elements.

  1. Create a class that implements HeimrichHannot\ConfigElementTypeBundle\ConfigElementType\ConfigElementTypeInterface
  2. Register the class as service with service tag huh.reader.config_element_type
  3. Add a friendly type name (translation) into the $GLOBALS['TL_LANG']['tl_reader_config_element']['reference'] variable

All versions of contao-reader-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
contao/core-bundle Version ^4.9
doctrine/dbal Version ^2.10 || ^3.0
heimrichhannot/contao-be_explanation-bundle Version ^2.2
heimrichhannot/contao-config-element-type-bundle Version ^0.2
heimrichhannot/contao-entity-filter-bundle Version ^1.0
heimrichhannot/contao-filter-bundle Version ^1.0
heimrichhannot/contao-request-bundle Version ^1.3
heimrichhannot/contao-status_messages Version ^1.0|^2.0
heimrichhannot/contao-twig-support-bundle Version ^0.2|^1.0
heimrichhannot/contao-utils-bundle Version ^2.206
symfony/config Version ^4.4||^5.4
symfony/console Version ^4.4||^5.4
symfony/dependency-injection Version ^4.4||^5.4
symfony/event-dispatcher Version ^4.4||^5.4
symfony/event-dispatcher-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/filesystem Version ^4.4||^5.4
symfony/http-foundation Version ^4.4||^5.4
symfony/http-kernel Version ^4.4||^5.4
symfony/polyfill-php80 Version ^v1.26.0
symfony/routing Version ^4.4||^5.4
symfony/service-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/translation Version ^4.4||^5.4
symfony/translation-contracts Version ^1.1.6||^2||^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package heimrichhannot/contao-reader-bundle contains the following files

Loading the files please wait ....