<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
heimrichhannot / contao-advanced-dashboard-bundle example snippets
/**
* @Hook("parseTemplate")
*/
class ParseTemplateListener
{
public function __invoke(Template $template): void
{
if ('be_welcome' === $template->getName()) {
$template->positionTop = '<div id="tl_custom_welcome">
<h2 style="margin-top: 18px;">Welcome</h2>
<p style="margin-top: 6px;">This could be your message!</p>
</div>';
$template->showShortcuts = false;
}
}
}
use HeimrichHannot\AdvancedDashboardBundle\Event\VersionListDatabaseColumnsEvent;
use HeimrichHannot\AdvancedDashboardBundle\Event\VersionListTableColumnsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AdvancedDashboardEventSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents(){
return [
VersionListDatabaseColumnsEvent::class => 'onVersionListDatabaseColumnsEvent',
VersionListTableColumnsEvent::class => 'onVersionListTableColumnsEvent',
];
}
// Add additional database columns that should be fetched (or modify existing values)
public function onVersionListDatabaseColumnsEvent(VersionListDatabaseColumnsEvent $event) {
$event->addColumn('custom_information');
}
// Add additional columns to the version list.
// `label` is the table column headline
// `renderCallback` is the method that renders the content of the current column.
// Gets the database values for the current row as parameter.
public function onVersionListTableColumnsEvent(VersionListTableColumnsEvent $event) {
$event->setColumn('custom_colum', [
'label' => 'Custom information',
'renderCallback' => function(array $version) {
return $version['custom_information'] ?: 'No custom information';
}
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.