Hallo zusammen,
ich versuche gerade ein Content Element nach dieser Anleitung https://docs.contao.org/dev/framework/content-elements/ zu erstellen. Mein Ziel wäre es, ein Container Element (ähnlich Bootstrap) als Wrapper umzusetzen, sodass andere Inhaltselemente von einem "container start" und einem "container end" umschlossen werden können.
Die beiden Content Elemente "container start" und "container end" werden mir auch angezeigt, allerdings nicht als Wrapper.
ContainerStart.php
PHP-Code:
<?php
declare(strict_types=1);
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;
/**
* @ContentElement(category="Grid")
*/
class ContainerStart extends AbstractContentElementController
{
protected function getResponse(Template $template, ContentModel $model, Request $request): ?Response
{
$headline = $model->headline;
return $template->getResponse();
}
}
config.php
PHP-Code:
$GLOBALS['TL_WRAPPERS']['start'][] = 'container_start';
$GLOBALS['TL_WRAPPERS']['stop'][] = 'container_end';
tl_content.php
PHP-Code:
$GLOBALS['TL_DCA']['tl_content']['palettes']['container_start'] = '
{type_legend},type,headline;
{template_legend:hide},customTpl;
{protected_legend:hide},protected;
{expert_legend:hide},guests,cssID;
{invisible_legend:hide},invisible,start,stop
';
$GLOBALS['TL_DCA']['tl_content']['palettes']['container_end'] = '
{type_legend},type,headline;
{template_legend:hide},customTpl;
{protected_legend:hide},protected;
{expert_legend:hide},guests,cssID;
{invisible_legend:hide},invisible,start,stop
';
Kann mir da jemand weiterhelfen? Bin gerade echt am verzweifeln...
Lesezeichen