heimrichhannot/contao-enhanced-accordions-bundle

This bundle enhances contao accordions.

0.1.1 2023-12-05 13:52 UTC

This package is auto-updated.

Last update: 2024-04-05 14:26:52 UTC


README

This bundle enhances the work with contao accordions for template designers and developers.

Features

  • add additional variables to accordions templates to create templates groups
  • optional bootstrap 5 enhancements for the default templates
  • bundles bootstrap 5 accordion templates

Usage

Install

Install with composer or contao manager and update your database.

composer require heimrichhannot/contao-enhanced-accordions-bundle

Use bootstrap 5 integration

screenshot.png

In your theme settings, select bootstrap 5 frontend framework and activate the checkbox "Adjust default template". This adds some css classes and markup to make the default work with boostrap 5 javascript component. This is no complete replacement, as the default templates can not completely adjust without overriding for bootstrap 5.

The bundle also provides bootstrap 5 accordion templates, that can be selected as custom template, copied to project or extended in your project templates.

If you extend the templates, there are some adjustments you can make:

{% extends "@Contao_HeimrichHannotEnhancedAccordionsBundle/ce_accordionStart_bs5.html.twig" %}

{% set open_first = true %}
{% set titleElement = 'h3' %}
{% extends "@Contao_HeimrichHannotEnhancedAccordionsBundle/ce_accordionStop_bs5.html.twig" %}
{% extends "@Contao_HeimrichHannotEnhancedAccordionsBundle/ce_accordionElement_bs5.html.twig" %}

{% set open_first = true %}
{% set titleElement = 'h3' %}

Additional template variables

The bundle adds additional variables to the accordion templates, that can be used to enhance your templates. A accordion group is defined by consecutively accordion start and stop elements OR single accordion elements.

Variable Description
accordion_parentId (int) The id of the first element of the accordion group.
accordion_first (bool) true if the element is the first element of the group.
accordion_last (bool) true if the element is the last element of the group.