Moin,
leider hänge ich jetzt schon seit zwei Tagen an einem Problem, das ich einfach nicht gelöst bekomme. Mein eigenes Content Element wird nicht geladen, wenn ich im Debug Modus bin, was das Debugging extrem erschwert. Das selbe Problem habe ich übrigens auch, wenn ich ein Content Element aus der Dokumentation erstelle.
contao/dca/tl_content.php
src/Controller/ContentElement/MyContentElementController.phpPHP-Code:<?php
$GLOBALS['TL_DCA']['tl_content']['palettes']['my_content_element'] = '{type_legend},type;{text_legend},text';
contao/templates/ce_my_content_element.html5PHP-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;
/**
* @ContentElement(category="texts")
*/
class MyContentElementController extends AbstractContentElementController
{
protected function getResponse(Template $template, ContentModel $model, Request $request): Response
{
$template->text = $model->text;
return $template->getResponse();
}
}
contao/languages/en/default.phpHTML-Code:<div class="my-content-element"> <?= $this->text; ?> </div>
contao/languages/de/default.phpPHP-Code:<?php
$GLOBALS['TL_LANG']['CTE']['my_content_element'] = [
'My Content Element',
'A Content Element for testing purposes.',
];
Danach habe ich in der Konsole folgendes ausgeführt, was auch ohne Fehlermeldung durch läuft.PHP-Code:<?php
$GLOBALS['TL_LANG']['CTE']['my_content_element'] = [
'My Content Element',
'A Content Element for testing purposes.',
];
Unter den Fragments wird der entsprechende Controller auch korrekt angezeigt.Code:php composer.phar install
Rufe ich das Ganze über die DEV-Umgebung auf, wird mir der Controller nicht mehr angezeigt.Code:$ php vendor/bin/contao-console debug:fragment Contao Fragments ================ ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- -------------------------------------------- Identifier Controller Renderer Render Options Fragment Options ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- -------------------------------------------- contao.content_element.colEnd ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\ColumnEndController forward ignore_errors : false category : euf_grid type : colEnd template : ce_colEnd contao.content_element.colStart ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\ColumnStartController forward ignore_errors : false category : euf_grid type : colStart template : ce_colStart contao.content_element.markdown Contao\CoreBundle\Controller\ContentElement\MarkdownController forward ignore_errors : false category : texts type : markdown template : ce_markdown contao.content_element.my_content_element App\Controller\ContentElement\MyContentElementController forward ignore_errors : false category : texts type : my_content_element template : ce_my_content_element contao.content_element.rowEnd ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\RowEndController forward ignore_errors : false category : euf_grid type : rowEnd template : ce_rowEnd contao.content_element.rowStart ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\RowStartController forward ignore_errors : false category : euf_grid type : rowStart template : ce_rowStart contao.content_element.template Contao\CoreBundle\Controller\ContentElement\TemplateController forward ignore_errors : false category : includes type : template template : ce_template contao.frontend_module.root_page_dependent_modules Contao\CoreBundle\Controller\FrontendModule\RootPageDependentModulesController forward ignore_errors : false category : miscellaneous type : root_page_dependent_modules template : mod_root_page_dependent_modules contao.frontend_module.template Contao\CoreBundle\Controller\FrontendModule\TemplateController forward ignore_errors : false category : miscellaneous type : template template : mod_template contao.frontend_module.two_factor Contao\CoreBundle\Controller\FrontendModule\TwoFactorController forward ignore_errors : false category : user type : two_factor template : mod_two_factor ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- --------------------------------------------
Hat jemand eine Idee, woran das liegen kann?Code:$ php vendor/bin/contao-console debug:fragment --env=dev Contao Fragments ================ ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- -------------------------------------------- Identifier Controller Renderer Render Options Fragment Options ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- -------------------------------------------- contao.content_element.colEnd ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\ColumnEndController forward ignore_errors : false category : euf_grid type : colEnd template : ce_colEnd contao.content_element.colStart ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\ColumnStartController forward ignore_errors : false category : euf_grid type : colStart template : ce_colStart contao.content_element.markdown Contao\CoreBundle\Controller\ContentElement\MarkdownController forward ignore_errors : false category : texts type : markdown template : ce_markdown contao.content_element.rowEnd ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\RowEndController forward ignore_errors : false category : euf_grid type : rowEnd template : ce_rowEnd contao.content_element.rowStart ErdmannFreunde\ContaoGridBundle\Controller\ContentElement\RowStartController forward ignore_errors : false category : euf_grid type : rowStart template : ce_rowStart contao.content_element.template Contao\CoreBundle\Controller\ContentElement\TemplateController forward ignore_errors : false category : includes type : template template : ce_template contao.frontend_module.root_page_dependent_modules Contao\CoreBundle\Controller\FrontendModule\RootPageDependentModulesController forward ignore_errors : false category : miscellaneous type : root_page_dependent_modules template : mod_root_page_dependent_modules contao.frontend_module.template Contao\CoreBundle\Controller\FrontendModule\TemplateController forward ignore_errors : false category : miscellaneous type : template template : mod_template contao.frontend_module.two_factor Contao\CoreBundle\Controller\FrontendModule\TwoFactorController forward ignore_errors : false category : user type : two_factor template : mod_two_factor ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- --------------------------------------------

Zitieren