heimrichhannot/contao-advanced-dashboard-bundle

A bundle to customize the contao backend dashboard.

Maintainers

Package info

github.com/heimrichhannot/contao-advanced-dashboard-bundle

Type:contao-bundle

pkg:composer/heimrichhannot/contao-advanced-dashboard-bundle

Transparency log

Statistics

Installs: 182

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.2.0 2026-08-19 13:19 UTC

This package is auto-updated.

Last update: 2026-08-19 13:31:15 UTC


README

Customize the Contao back end dashboard and control which version-log entries are visible to back end users.

Features

  • Replaces the Contao dashboard with an extensible native Twig template.
  • Restricts version entries by user and database table.
  • Provides events for filtering version entries and customizing version rows.

Requirements

  • PHP ^8.4
  • Contao ^5.7
  • Symfony components ^7.4
  • Doctrine DBAL ^3.7 or ^4.3

Installation

Install the bundle with Composer or the Contao Manager and then update the database:

composer require heimrichhannot/contao-advanced-dashboard-bundle

Configure version rights

Add one or more versions_rights entries to the project configuration, usually in config/config.yaml:

huh_advanced_dashboard:
  versions_rights:
    # Show changes from all users, but only for tl_news.
    editor_news:
      user_access_level: all
      tables:
        - tl_news

Clear the application cache, then assign the new version right in the settings of a back end user or user group.

If no assigned configuration matches, the bundle uses the default configuration. Administrators are always unrestricted. An empty tables list means that all tables are allowed.

When multiple rights are assigned, their table lists are combined. An empty tables list makes the table selection unrestricted, and user_access_level: all takes precedence over self.

Customize the dashboard template

The dashboard uses Contao's native template hierarchy. Create [TWIG-ROOT]/be_advanced_dashboard.html.twig and extend the bundle template:

{% extends "@Contao_HeimrichHannotAdvancedDashboardBundle/be_advanced_dashboard.html.twig" %}

{% block messages %}
    <section id="tl_custom_welcome">
        <h2>Welcome</h2>
        <p>This could be your message!</p>
    </section>

    {{ parent() }}
{% endblock %}

{% block shortcuts %}{% endblock %}
{% block credits %}{% endblock %}

The following blocks are available:

  • dashboard
  • messages
  • shortcuts
  • versions
  • credits

Override dashboard to change the complete layout. To add content to an existing section, override its block and call {{ parent() }} before or after the custom markup. Override a section with an empty block to hide it.

The old position and visibility variables and the Twig Support Bundle events are no longer supported. Version table columns are now defined by the versions block instead of the removed versions_rights.*.columns option.

Filter version entries

Use VersionListFilterEvent to customize the Doctrine DBAL query after the configured user and table restrictions have been applied:

<?php

declare(strict_types=1);

namespace App\EventListener;

use HeimrichHannot\AdvancedDashboardBundle\Event\VersionListFilterEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

class AdvancedDashboardFilterListener
{
    #[AsEventListener]
    public function onVersionListFilter(VersionListFilterEvent $event): void
    {
        $event->queryBuilder
            ->addSelect('memberId')
            ->andWhere('fromTable != :advancedDashboardExcludedTable')
            ->setParameter('advancedDashboardExcludedTable', 'tl_internal_record')
        ;
    }
}

The event provides the query builder and the active VersionListConfiguration. Use addSelect() to make additional tl_version columns available to VersionListRowEvent. The event is dispatched once for the count query and once for the result query, so listeners must apply deterministic changes to both queries. Use unique parameter names to avoid collisions with the built-in filters.

Customize version rows

Use VersionListRowEvent to modify each prepared version row:

<?php

declare(strict_types=1);

namespace App\EventListener;

use HeimrichHannot\AdvancedDashboardBundle\Event\VersionListRowEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

class AdvancedDashboardListener
{
    #[AsEventListener]
    public function onVersionListRow(VersionListRowEvent $event): void
    {
        $event->row['description'] = strtoupper((string) $event->row['description']);
    }
}

The event receives the complete prepared tl_version row, including values such as date, username, shortTable, description and operations. Override the versions block if you need to render additional row values or table columns.

Configuration reference

huh_advanced_dashboard:
  versions_rights:
    name:
      # Empty means all tables.
      tables: []

      # One of "all" or "self".
      user_access_level: self