Ergebnis 1 bis 4 von 4

Thema: Controller für eigenes Content Element wird im Debug Modus nicht geladen

  1. #1
    Contao-Nutzer Avatar von chatjack
    Registriert seit
    02.09.2012.
    Ort
    Essen
    Beiträge
    160

    Standard Controller für eigenes Content Element wird im Debug Modus nicht geladen

    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
    PHP-Code:
    <?php

    $GLOBALS
    ['TL_DCA']['tl_content']['palettes']['my_content_element'] = '{type_legend},type;{text_legend},text';
    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;

    /**
     * @ContentElement(category="texts")
     */
    class MyContentElementController extends AbstractContentElementController
    {
        protected function 
    getResponse(Template $templateContentModel $modelRequest $request): Response
        
    {
            
    $template->text $model->text;
            
            return 
    $template->getResponse();
        }
    }
    contao/templates/ce_my_content_element.html5
    HTML-Code:
    <div class="my-content-element">    
        <?= $this->text; ?>
    </div>
    contao/languages/en/default.php
    PHP-Code:
    <?php

    $GLOBALS
    ['TL_LANG']['CTE']['my_content_element'] = [
        
    'My Content Element'
        
    'A Content Element for testing purposes.',
    ];
    contao/languages/de/default.php
    PHP-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.

    Code:
    php composer.phar install
    Unter den Fragments wird der entsprechende Controller auch korrekt 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                   
     ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- --------------------------------------------
    Rufe ich das Ganze über die DEV-Umgebung auf, wird mir der Controller nicht mehr angezeigt.


    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                   
     ---------------------------------------------------- --------------------------------------------------------------------------------- ---------- ----------------------- --------------------------------------------
    Hat jemand eine Idee, woran das liegen kann?
    Geändert von chatjack (27.04.2023 um 13:55 Uhr)

  2. #2
    Contao-Nutzer
    Registriert seit
    10.06.2021.
    Beiträge
    242
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Dev-Cache hast du geleert?

  3. #3
    Contao-Nutzer Avatar von chatjack
    Registriert seit
    02.09.2012.
    Ort
    Essen
    Beiträge
    160

    Standard

    Der Dev-Cache wurde bei der Ausführung von "php composer.phar install" bereits gelöscht. Ich hatte es aber auch noch Mal mit folgendem Befehl versucht. Leider vergeblich.

    Code:
    php vendor/bin/contao-console cache:clear --env=dev

  4. #4
    Contao-Nutzer Avatar von chatjack
    Registriert seit
    02.09.2012.
    Ort
    Essen
    Beiträge
    160

    Standard

    Ich habe die Instanz jetzt noch Mal komplett neu aufgesetzt und nun tauchen beide Controller auch im Debug-Modus auf. Leider musste ich das inzwischen schon zum dritten Mal machen, weil ich nicht nachvollziehen konnte, warum der Controller im Debug-Modus nicht geladen wurde.

    Gibt es neben "php vendor/bin/contao-console debug:fragment --env=dev" noch andere Möglichkeiten besser nachverfolgen zu können, wie die Controller über Annotations geladen werden? Das ist für mich nach wie vor eine ziemliche Blackbox.

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •