PHP-Code:
namespace App\Controller\FrontendModule;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
//use Contao\CoreBundle\ServiceAnnotation\FrontendModule;
use Contao\CoreBundle\DependencyInjection\Attribute\AsFrontendModule;
use Contao\BackendTemplate;
use Contao\Config;
use Contao\Controller;
use Contao\CoreBundle\Exception\PageNotFoundException;
use Contao\Date;
use Contao\Environment;
use Contao\Events;
use Contao\FilesModel;
use Contao\FrontendTemplate;
use Contao\Input;
use Contao\ModuleEventlist;
use Contao\ModuleModel;
...
#[AsFrontendModule(category: 'xxx', priority: 1, template: 'mod_eventlist_xxx')]
class EventlistXxxController extends ModuleEventlist
{
public function __construct() {}
public function __invoke(ModuleModel $model, string $section): Response
{
parent::__construct($model, $section);
return new Response($this->generate());
}
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
//...
}
}
# config/services.yml
services:
_defaults:
autowire: true
autoconfigure: true
public: false
App\:
resource: ../src
exclude: ../src/{Entity,Migrations,Resources,Tests}
App\Controller\:
resource: ../src/Controller
public: true
#config/routes.yaml
app.controller:
resource: ../src/Controller
type: attribute
Hatte es unter 4.13 mit annotation und jetzt mit attribute probiert.