Hallo,
ich habe leider Probleme mit dem
PHP-Code:
'inputType' => 'url',
, denn im Frontend wird der Link nicht ausgegeben. Es erscheint ein leeres div.
Es ist mein erster Versuch, Custom Elements zu erstellen und ich habe angefangen, das Team-Beispiel von RSCE umzubiegen. Leider eben mit oben genanntem Erfolg. Hier mein Code:
PHP-Code:
<?php
// rsce_boxes_config.php
return array(
'label' => array('Grafischer Teaser', 'Erzeugt eine...'),
'types' => array('content'),
'contentCategory' => 'texts',
'standardFields' => array('headline', 'cssID'),
'fields' => array(
'boxes' => array(
'label' => array('Textboxen', ''),
'elementLabel' => '%s. Box',
'inputType' => 'list',
'minItems' => 1,
'maxItems' => 4,
'fields' => array(
'headline' => array(
'label' => array(
'de' => array('Überschrift', ''),
'en' => array('Headline', ''),
),
'inputType' => 'text',
),
'text' => array(
'label' => array(
'de' => array('Unterzeile', ''),
'en' => array('Subheading', ''),
),
'inputType' => 'textarea',
),
'link' => array(
'label' => array(
'de' => array('Link einfügen', ''),
'en' => array('Insert link', ''),
),
'inputType' => 'url',
),
'image' => array(
'label' => array(
'de' => array('Hintergrundbild', ''),
'en' => array('Background image', ''),
),
'inputType' => 'fileTree',
'eval' => array(
'fieldType' => 'radio',
'filesOnly' => true,
'extensions' => 'jpg,jpeg,png,gif,svg',
),
),
),
),
),
);
HTML-Code:
<!-- rsce_boxes.html5 -->
<section class="<?php echo $this->class ?> block"<?php echo $this->cssID ?>>
<?php foreach ($this->boxes as $box): ?>
<section class="box">
<?php if ($image = $this->arrData['getImageObject']($box->image, array(180, 180))): ?>
<img class="" src="<?php echo $image->src ?>" alt="<?php echo $image->alt ?: $member->name ?>"<?php echo $image->imgSize ?>>
<?php endif ?>
<h2>
<?php echo $box->headline ?>
</h2>
<div>
<?php echo $box->text ?>
</div>
<div>
{{link::<?php echo $box->link ?>}}
</div>
<?php var_dump($box) ?>
</section>
<?php endforeach ?>
</section>
Der var-dump liefert dieses Ergebnis:
object(stdClass)#467 (4) { ["headline"]=> string(9) "Über uns" ["text"]=> string(10) "Unterzeile" ["link"]=> string(15) "%C3%BCber-uns/gesch%C3%A4ftsf%C3%BChrung.html" ["image"]=> string(36) "1f1538ba-ff86-11e7-84e3-0deb75894ce4" }
Und das hier ist der im Frontend ausgegebene Code:
HTML-Code:
<section class="box">
<img class="" src="assets/images/4/placeholder-1920x1080-8636e614.jpg" alt="placeholder" width="180" height="180">
<h2>
Über uns
</h2>
<div>
Unterzeile
</div>
<div>
</div>
object(stdClass)#467 (4) {
["headline"]=>
string(9) "Über uns"
["text"]=>
string(10) "Unterzeile"
["link"]=>
string(15) "%C3%BCber-uns/gesch%C3%A4ftsf%C3%BChrung.html"
["image"]=>
string(36) "1f1538ba-ff86-11e7-84e3-0deb75894ce4"
}
</section>
Kann jemand weiterhelfen?
Lesezeichen