Ergebnis 1 bis 9 von 9

Thema: RSCE mit standardField 'target' und 'fullsize'

  1. #1
    Community-Moderator & Contao-Urgestein Avatar von derRenner
    Registriert seit
    23.10.2012.
    Ort
    hoRn|waldviertel
    Beiträge
    2.862
    Contao-Projekt unterstützen

    Support Contao

    Standard RSCE mit standardField 'target' und 'fullsize'

    Hallo,

    in einem RSCE verwende ich für die Auswahl eines Bildes
    PHP-Code:
            'singleSRC' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'mandatory' => false,
                ],
            ],
            
    'size' => [
                
    'inputType' => 'standardField'
            
    ],
            
    'imagemargin' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w50 clr'
                
    ]
            ],
            
    'fullsize' => [
                
    'inputType' => 'standardField',
            ],
            
    'overwriteMeta' => [
                
    'inputType' => 'standardField',
            ], 
    ebenfalls mit drinnen, verwende ich die Hyperlink-Felder
    PHP-Code:
            'url' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'mandatory' => false
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'linkTitle' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'titleText' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'target' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33 m12'
                
    ]
            ], 
    Jetzt passiert folgendes:
    Wenn ich im Bild-Bereich 'Großansicht/Neues Fenster' anhake, dann wird $this->titleText nicht mehr ausgegeben.

    Die Ausgabe für den Link sieht so aus:
    PHP-Code:
    <a href="<?= $this->url ?>" class="info-link <?php if ($this->linkClass): echo $this->linkClass; endif; ?>" title="<?= $this->titleText ?><?php if ($this->target): ?> target="_blank"<?php endif; ?>><?= $this->linkTitle ?></a>
    Bei angehakter 'Großansicht/Neues Fenster' bekommt das Frontend:
    PHP-Code:
    <a href="zimmer-detail/doppelbettzimmer.html" class="info-link btn btn-outline-primary rounded-0" title="Doppelbettzimmer"></a
    Es scheint, als kämen sich hier die beiden 'target' aus verschiedener Quelle im gleichen RSCE in die Quere
    Hat jemand einen Lösungsansatz?
    Grüsse
    Bernhard


  2. #2
    Community-Moderatorin & Contao-Urgestein Avatar von mlweb
    Registriert seit
    10.07.2011.
    Beiträge
    6.751
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Aus welchem Feld kommt "Doppelzimmer"?

    Nachtrag: Aber davon abgesehen - für die Großansicht kommen die Daten m.E. aus den Metadaten des Bildes. Ist also m.E. normal, so gewollt und für mich auch sachlich richtig.
    Geändert von mlweb (02.11.2023 um 08:29 Uhr)
    Ich habe Dir mit meinen Hinweisen geholfen und Du möchtest Dich bedanken?
    Unterstütze bitte das Contao-Projekt (Button Links)
    Weitere Spendenmöglichkeiten
    ------------------------------------------------------------------------------------------------------
    Contao-Dokumentation: Contao-Handbuch und Contao-Entwickler-Doku
    Contao-Online-Video-Kurse: Contao Academy
    Funktionalität erweitern: Contao-Erweiterungen

    Für Dinge die man mit html5 und css3 lösen kann, braucht man kein javascript.




  3. #3
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Poste das gesamte Template und die gesamte Config.
    » sponsor me via GitHub or PayPal or Revolut

  4. #4
    Community-Moderator & Contao-Urgestein Avatar von derRenner
    Registriert seit
    23.10.2012.
    Ort
    hoRn|waldviertel
    Beiträge
    2.862
    Contao-Projekt unterstützen

    Support Contao

    Standard

    PHP-Code:
    <?php

    return [
        
    'label' => ['Info-Box','Erstellen Sie eine Info-Box.'],
        
    'types' => ['content'],
        
    'contentCategory' => 'texts',
        
    'standardFields' => ['cssID'],
        
    'fields' => [
            
    'headline' => [
                
    'inputType' => 'standardField',

            ],
            
    'subheadline' => [
                
    'label' => ['Unterüberschrift','Geben Sie die Unterschrift ein. HTML ist erlaubt.'],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'clr w50'
                    
    'allowHtml' => true
                
    ],
            ],
            
    'subheadlinePostion' => [
                
    'label' => ['Position der Unterüberschrift','Vergeben Sie die Position der Unterschrift.'],
                
    'inputType' => 'select',
                
    'options' => [
                    
    'top' => 'Oben'
                    
    'bottom' => 'Unten'
                
    ],
                
    'eval' => [
                    
    'tl_class' => 'w50'
                
    ],
                
    'default' => 'bottom'
            
    ],
            
    'text' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'clr',
                ],
            ],
            
    'html' => [
                
    'inputType' => 'standardField',
            ],
            
    'imgLegend' => [
                
    'label' => ['Info-Box-Bild',''],
                
    'inputType' => 'group',
            ],
            
    'singleSRC' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'mandatory' => false,
                ],
            ],
            
    'size' => [
                
    'inputType' => 'standardField'
            
    ],
            
    'imagemargin' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w50 clr'
                
    ]
            ],
            
    'fullsize' => [
                
    'inputType' => 'standardField',
            ],
            
    'overwriteMeta' => [
                
    'inputType' => 'standardField',
            ],
            
    'linkLegend' => [
                
    'label' => ['Info-Box-Button',''],
                
    'inputType' => 'group',
            ],
            
    'url' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'mandatory' => false
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'linkTitle' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'titleText' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'target' => [
                
    'inputType' => 'standardField',
                
    'eval' => [
                    
    'tl_class' => 'w33 m12'
                
    ]
            ],
            
    'linkClass' => [
                
    'label' => ['CSS-Klasse','Hier können Sie beliebig viele Klassen für den Button eingeben.'],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ],
            
    'linkPosition' => [
                
    'label' => ['Position des Buttons','Vergeben Sie die Position des Buttons.'],
                
    'inputType' => 'select',
                
    'options' => [
                    
    'btn-pos-left' => 'Links'
                    
    'btn-pos-center' => 'Mittig',
                    
    'btn-pos-right' => 'Rechts'
                
    ],
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ],
                
    'default' => 'btn-pos-left'
            
    ],
        ]   
    ];

    PHP-Code:
    <div class="<?= $this->class ?>"<?= $this->cssID ?>>
        <div class="info-box-wrapper">
            <div class="info-box-inner">
                <?php if ($this->addImage): ?>
                <div class="info-box-image">
                    <figure class="image_container" <?php if ($this->margin): ?> style="<?= $this->margin ?>"<?php endif; ?>>

                        <?php if ($this->href): ?>
                        <a href="<?= $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
                        <?php endif; ?>

                        <?php $this->insert('picture_default'array_merge($this->picture)); ?>

                        <?php if ($this->href): ?>
                        </a>
                        <?php endif; ?>

                    </figure>
                </div>
                <?php endif; ?>
                
                <?php if ($this->headline): ?>
                <div class="info-box-headline">
                <<?= $this->hl ?> >
                <?php if ($this->subheadlinePostion == 'top' && $this->subheadline): ?>
                    <span class="subheadline subheadline-top"><?= $this->subheadline ?></span>
                <?php endif; ?>
                <span class="hl-ext"><?= $this->headline ?></span>
                <?php if ($this->subheadlinePostion == 'bottom' && $this->subheadline): ?>
                    <span class="subheadline subheadline-bottom"><?= $this->subheadline ?></span>
                <?php endif; ?>
                </<?= $this->hl ?>>
                </div>        
                <?php endif; ?>            

                <?php if ($this->text): ?>
                <div class="info-box-info">
                    <?= $this->text ?>
                </div>
                <?php endif; ?>    
                
                

            </div>

            <?php if ($this->html): echo $this->html; endif; ?>

            <?php if ($this->url): ?>
            <div class="info-box-button <?= $this->linkPosition ?>">
                <p class="link-wrapper">
                    <a href="<?= $this->url ?>" class="info-box-link <?php if ($this->linkClass): echo $this->linkClass; endif; ?>" title="<?= $this->titleText ?><?php if ($this->target): ?> target="_blank"<?php endif; ?>><?= $this->linkTitle ?></a>
                </p>
            </div>
            <?php endif; ?>
        </div>    
    </div>
    Grüsse
    Bernhard


  5. #5
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Du verwendest in deinem Template
    PHP-Code:
                <?php if ($this->addImage): ?>
                <div class="info-box-image">
                    <figure class="image_container" <?php if ($this->margin): ?> style="<?= $this->margin ?>"<?php endif; ?>>

                        <?php if ($this->href): ?>
                        <a href="<?= $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
                        <?php endif; ?>

                        <?php $this->insert('picture_default'array_merge($this->picture)); ?>

                        <?php if ($this->href): ?>
                        </a>
                        <?php endif; ?>

                    </figure>
                </div>
                <?php endif; ?>
    Aber woher kommen diese Daten?
    » sponsor me via GitHub or PayPal or Revolut

  6. #6
    Community-Moderator & Contao-Urgestein Avatar von derRenner
    Registriert seit
    23.10.2012.
    Ort
    hoRn|waldviertel
    Beiträge
    2.862
    Contao-Projekt unterstützen

    Support Contao

    Standard

    sorry, hatte den <php>-Teil nicht mitkompiert

    PHP-Code:
    <?php

    $this
    ->class trim($this->class ' info-box');

    $fileModel = \Contao\FilesModel::findByUuid($this->singleSRC);

    if (
    $fileModel !== null && is_file(TL_ROOT '/' $fileModel->path)) {
        
    $figure = \Contao\System::getContainer()
            ->
    get('contao.image.studio')
            ->
    createFigureBuilder()
            ->
    from($fileModel->path)
            ->
    setSize($this->size)
            ->
    setMetadata((new \Contao\ContentModel())->setRow($this->arrData)->getOverwriteMetadata())
            ->
    enableLightbox((bool) $this->fullsize)
            ->
    buildIfResourceExists();

        if (
    null !== $figure) {
            
    $figure->applyLegacyTemplateData($this$this->imagemargin);
        }
    }
    ?>

    <div class="<?= $this->class ?>"<?= $this->cssID ?>>
        <div class="info-box-wrapper">
            <div class="info-box-inner">
                <?php if ($this->addImage): ?>
                <div class="info-box-image">
                    <figure class="image_container" <?php if ($this->margin): ?> style="<?= $this->margin ?>"<?php endif; ?>>

                        <?php if ($this->href): ?>
                        <a href="<?= $this->href ?>"<?php if ($this->linkTitle): ?> title="<?= $this->linkTitle ?>"<?php endif; ?><?= $this->attributes ?>>
                        <?php endif; ?>

                        <?php $this->insert('picture_default'array_merge($this->picture)); ?>

                        <?php if ($this->href): ?>
                        </a>
                        <?php endif; ?>

                    </figure>
                </div>
                <?php endif; ?>
                
                <?php if ($this->headline): ?>
                <div class="info-box-headline">
                <<?= $this->hl ?> >
                <?php if ($this->subheadlinePostion == 'top' && $this->subheadline): ?>
                    <span class="subheadline subheadline-top"><?= $this->subheadline ?></span>
                <?php endif; ?>
                <span class="hl-ext"><?= $this->headline ?></span>
                <?php if ($this->subheadlinePostion == 'bottom' && $this->subheadline): ?>
                    <span class="subheadline subheadline-bottom"><?= $this->subheadline ?></span>
                <?php endif; ?>
                </<?= $this->hl ?>>
                </div>        
                <?php endif; ?>            

                <?php if ($this->text): ?>
                <div class="info-box-info">
                    <?= $this->text ?>
                </div>
                <?php endif; ?>    
                
                

            </div>

            <?php if ($this->html): echo $this->html; endif; ?>

            <?php if ($this->url): ?>
            <div class="info-box-button <?= $this->linkPosition ?>">
                <p class="link-wrapper">
                    <a href="<?= $this->url ?>" class="info-box-link <?php if ($this->linkClass): echo $this->linkClass; endif; ?>" title="<?= $this->titleText ?><?php if ($this->target): ?> target="_blank"<?php endif; ?>><?= $this->linkTitle ?></a>
                </p>
            </div>
            <?php endif; ?>
        </div>    
    </div>
    Grüsse
    Bernhard


  7. #7
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Du musst immer alles posten. Der Fehler liegt eben genau dort:
    PHP-Code:
    $figure->applyLegacyTemplateData($this$this->imagemargin); 
    Damit überschreibst du dir gewisse Variablen, inkl. linkTitle.
    » sponsor me via GitHub or PayPal or Revolut

  8. #8
    Community-Moderator & Contao-Urgestein Avatar von derRenner
    Registriert seit
    23.10.2012.
    Ort
    hoRn|waldviertel
    Beiträge
    2.862
    Contao-Projekt unterstützen

    Support Contao

    Standard

    OK, DANKE für den Hinweis bzw. die Fehlerquelle!

    Habe linkTitle für den Button nun abgeändert auf linkTitleButton, sodass sich diese nicht mehr in Quere kommen

    PHP-Code:
            'linkTitleButton' => [
                
    'label' => ['Link-Text','Der Link-Text wird anstelle der Link-Adresse angezeigt.'],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w33'
                
    ]
            ], 
    PHP-Code:
            <?php if ($this->url): ?>
            <div class="info-box-button <?= $this->linkPosition ?>">
                <p class="link-wrapper">
                    <a href="<?= $this->url ?>" class="info-box-link <?php if ($this->linkClass): echo $this->linkClass; endif; ?>" title="<?= $this->titleText ?><?php if ($this->target): ?> target="_blank"<?php endif; ?>><?= $this->linkTitleButton ?></a>
                </p>
            </div>
            <?php endif; ?>
    Grüsse
    Bernhard


  9. #9
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Du kannst auch linkTitle lassen - aber ich würde dir für Bilder empfehlen entweder die von den RSCEs zur Verfügung gestellte Methode $this->getImageObject zu nutzen - oder in Contao 4.13+ $this->figure.
    » sponsor me via GitHub or PayPal or Revolut

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
  •