Verwendung: Option Callback Wert ausgeben
Produkt: Custom Elements Contao
Ich stehe gerade auf dem Schlauch und die Antwort ist sicher mega einfach...
Wie kann ich aus einer Liste den Wert statt dem Label ausgeben?
'person' => array(
'label' => array('Person auswählen', ''),
'inputType' => 'select',
'default' => '',
'options_callback' => function() {
return array(
'123' => 'Max Mustermann',
'543' => 'Frauke Müller',
'232' => 'Sigmund Freud',
'133' => 'Dalai Lama',
);
},
'eval' => array('tl_class' => 'clr w50'),
),
Template
<?= $this->person ?>
gibt mir immer nur das Label aus - also 123 oder 543
Vielen Dank für Eure Hilfe.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by RockSolid Theme... on 05 Nov, 2021 10:29 AM
Vielen Dank für Ihre Frage.
Dazu können Sie entweder das Array des Callbacks verändern:
Oder alternativ die Zuordnung der Werte zur Bezeichnung im Template vornehmen: