Standardfield Headline in Twig
Hallo,
wie kann ich folgendes mit einem Twig-Template umsetzen:
RSCE Config
PHP-Code:
'headline' => array(
'label' => array('Überschrift', 'Geben Sie eine Überschrift ein'),
'inputType' => 'standardField',
'options' => array('h2', 'h3', 'h4'),
'eval' => array(
'mandatory' => true,
),
),
Bisher im RSCE HTML:
PHP-Code:
<<?php echo $this->hl ?>>
<?php echo $this->headline ?>
</<?php echo $this->hl ?>>
Die Ausgabe war korrekt mit der gewählten Größe (h2, h3, h4).
Im RSCE Twig:
Die Ausgabe erfolgt leider ohne h-Tags, wie bekomme ich die rein?
Oder muss ich das mit einem weiteren Select für die Größe (h2, h3, h4) in meiner Config umsetzen?
Gruß Michael
Nutzung des StandardField mit RSCE
Das geht natürlich auch so um das Standard-Feld von Contao zu nutzen :)
Siehe Doku: https://rocksolidthemes.com/de/conta...standard-field
RSCE Config
PHP-Code:
<?php
// rsce_my_element_config.php
return array(
'label' => array('Mein Element', 'Meine Beschreibung...'),
'types' => array('content'),
'fields' => array(
'headline' => array(
'inputType' => 'standardField',
'options' => array('h2', 'h3', 'h4'),
),
// ...
),
);
Mit extending der Headline im html5 Template und anpassen des headline type kommt es ja automatisch von Contao und kann sogar von RSCE angepasst werden <3
HTML5-Template
PHP-Code:
<?php $this->extend('block_searchable'); ?> // Das headline feld ist in der block_searchable
<?php $this->block('content'); ?>
// ...
<?php $this->endblock(); ?>
Das Twig-pendant dazu wäre dann glaube nur das hier:
Twig-Template
PHP-Code:
{% extends "@Contao/content_element/_base.html.twig" %} {# <-- ist das damalige block searchable / unsearchable #}
{% block content %}
{# Weiteres #}
{% endblock %}