Zitat von
Spooky
Poste mal deinen gesamten bisherigen Code, mit Angabe wo sich die jeweilige Datei befindet, relativ zum Installationsverzeichnis der Contao Installation.
src/Controller/ContentElement/MyContentElementController.php
PHP-Code:
<?php
namespace App\Controller\ContentElement;
use Contao\ContentModel;
use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController;
use Contao\CoreBundle\ServiceAnnotation\ContentElement;
use Contao\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
/**
* @ContentElement(
* "test",
* category="Symfony")
*/
class MyContentElementController extends AbstractContentElementController
{
protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response
{
dump($GLOBALS['TL_DCA']);
$template->text = $model->text;
return $template->getResponse();
}
}
dca/tl_content
PHP-Code:
$GLOBALS['TL_DCA']['tl_content']['palettes']['test'] =
'{type_legend},type;{text_legend},text'
;
templates/ce_test.html5 (Warum muss es eig. html5 sein?)
Code:
<h5>Hello World</h5>
Backend -> leer
leer.PNG