PHPackages                             heimrichhannot/contao-flare-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. heimrichhannot/contao-flare-bundle

ActiveContao-bundle[Utility &amp; Helpers](/categories/utility)

heimrichhannot/contao-flare-bundle
==================================

Filter, list, and read entities with this bundle for Contao Open Source CMS.

0.0.34(5mo ago)4795↓50%1[1 PRs](https://github.com/heimrichhannot/contao-flare-bundle/pulls)LGPL-3.0-or-laterPHPPHP ^8.2CI passing

Since Sep 4Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/heimrichhannot/contao-flare-bundle)[ Packagist](https://packagist.org/packages/heimrichhannot/contao-flare-bundle)[ RSS](/packages/heimrichhannot-contao-flare-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (54)Used By (0)

FLARE 🔥 Filter, List and Reader Bundle
======================================

[](#flare--filter-list-and-reader-bundle)

This Contao CMS extension streamlines the filtering and listing of entities on the frontend while also supporting individual detail views (readers).

Note

Flare is a work in progress and is not yet feature-complete. We are actively working on it and will release updates regularly.

Installation
------------

[](#installation)

Install the bundle via Composer:

```
composer require heimrichhannot/contao-flare-bundle
```

Requires **Contao ^4.13 or ^5.0** and **PHP ^8.2**.

Features
--------

[](#features)

- Filter and list entities (e.g. news, events, or any generic data-container)
- Ease of use:
    - Only one place to manage list and filter configurations
    - Only two content elements (a list view with filter, and a reader)
- Filter forms created and displayed using [Symfony Forms](https://symfony.com/doc/6.4/forms.html)
- Pagination included (not based on Contao's pagination, this one is actually good!)
- Individual detail views (readers) using the Contao standard `auto_item` feature
- Batteries-included: Comes with a set of predefined filter and list types
- Customizable filter and list templates
- Extensible with custom filter and list types
- Integration with [terminal42/contao-DC\_Multilingual](https://github.com/terminal42/contao-DC_Multilingual)and [terminal42/contao-changelanguage](https://github.com/terminal42/contao-changelanguage), respectively
- No modules, no worries!

Usage
-----

[](#usage)

1. Create a new list configuration in the Contao backend under "Layout" → "Lists FLARE"
2. Each list is an archive of filter elements: add filters as children to the list configuration
3. Add a list view content element to a page and select the list configuration
4. Add a reader content element to a separate page and select the list configuration
5. Select the reader page in the list configuration
6. Profit!

### Filter Configuration

[](#filter-configuration)

Each filter element type specifies its own configuration options. The following options are available for all filter types:

- **Title**: A title that should briefly describe the filter and is shown in the backend listings.
- **Type**: The filter element type to use.
- **Intrinsic**: If checked, the filter is always applied to the list view and not visible in the form shown to the user.
- **Published**: If unchecked, the filter is not shown in the form and not applied when filtering the list view.

#### What is intrinsic?

[](#what-is-intrinsic)

- Each filter has an "intrinsic" option, which means that the filter is always applied to the list view and not visible in the form shown to the user.
- A filter that has intrinsic unchecked is shown in the form and can be used by the user to filter the list view.
- Some filters can only be intrinsic, e.g. the "published" filter. Under the hood, these filters do not specify a Symfony FormType.

Events
------

[](#events)

FLARE dispatches several events that can be used to modify the behavior of the filter and list types.

Note

Flare's event namespace is `HeimrichHannot\FlareBundle\Event`.

Some events have an aliased name, allowing event listeners to target them more specifically. These events are dispatched twice: once using their generic event class name, and again using their specific aliased name. This way you can implement listeners for both the generic event and the aliased event depending on your needs.

### Form Generation

[](#form-generation)

FLARE dispatches events when generating the filter form.

#### `FilterFormBuildEvent`

[](#filterformbuildevent)

*Alias: `flare.form..build`*

Dispatched when building the filter form, after all filter elements have been assembled.

#### `FilterFormChildOptionsEvent`

[](#filterformchildoptionsevent)

*Alias: `flare.form..child..options`*

Dispatched when assembling the options for each filter element's child form field.

Note

These are the options passed to the Symfony Form type (the third argument of `$builder->add()`), not “Contao field options”. Selectable items are configured via `choices` (and related) options.

### Item Retrieval

[](#item-retrieval)

FLARE dispatches events when retrieving items from the database.

#### `FetchAutoItemEvent`

[](#fetchautoitemevent)

Dispatched when retrieving an `auto_item` from the database, e.g., when a reader is displayed.

#### `FetchCountEvent`

[](#fetchcountevent)

*Alias: `flare.list..fetch_count`*

Dispatched when retrieving the total count of items that belong to a list.

#### `FetchListEntriesEvent`

[](#fetchlistentriesevent)

*Alias: `flare.list..fetch_entries`*

Dispatched when retrieving the sorted and paginated items that belong to a list.

### Filter Element

[](#filter-element)

Flare dispatches events when filter elements are being invoked.

#### `FilterElementInvokingEvent`

[](#filterelementinvokingevent)

*Alias: `flare.filter_element..invoking`*

Dispatched before a filter element is being invoked.

#### `FilterElementInvokedEvent`

[](#filterelementinvokedevent)

*Alias: `flare.filter_element..invoked`*

Dispatched after a filter element has been invoked.

### List View

[](#list-view)

Flare dispatches events when a list view is built and rendered.

#### `ListViewCreateBuilder`

[](#listviewcreatebuilder)

Dispatched when creating a list view builder.

#### `ListViewBuildEvent`

[](#listviewbuildevent)

Dispatched when building the list view.

#### `ListViewRenderEvent`

[](#listviewrenderevent)

Dispatched when rendering the list view.

#### `ListViewDetailsPageUrlGeneratedEvent`

[](#listviewdetailspageurlgeneratedevent)

Dispatched when generating each URL to the detail page.

### Details Reader

[](#details-reader)

Flare dispatches events when a details reader is rendered.

#### `ReaderRenderEvent`

[](#readerrenderevent)

Dispatched when rendering a reader.

### Palette Manipulation

[](#palette-manipulation)

Flare dispatches events when a list configuration's or filter element's palette is being assembled.

#### `PaletteEvent`

[](#paletteevent)

- *Alias: `flare.list..palette`*
- *Alias: `flare.filter_element..palette`*

Dispatched when assembling the palette of a list or filter.

Extending FLARE
---------------

[](#extending-flare)

We encourage you to extend FLARE with custom filter and list types. This is done by creating a new class with the `#[AsFilterElement]` or `#[AsListType]` attributes and implementing the `__invoke()` method. See the examples below.

### Creating a custom filter element

[](#creating-a-custom-filter-element)

```
