FormSelectMenu-Widget

Aus Contao Community Documentation

Um ein Selectfeld als Formular-Widget zu definieren, wird es folgendermaßen angelegt und anschließend an das Template übergeben.

<?php
 
...
 
$inputRadius = new FormSelectMenu();
$inputRadius->id = 'searchradius';
$inputRadius->name = 'radius';
$inputRadius->label = 'Umkreis';
$inputRadius->class = 'select';
$inputRadius->value = $this->Input->post('radius');
$inputRadius->options = array( 
	    array('value'=>'', 'label'=>'+0km'),
	    array('value'=>'20','label'=>'+20km'),
	    array('value'=>'50','label'=>'+50km'),
	    array('value'=>'100','label'=>'+100km'),
	    array('value'=>'150','label'=>'+150km'),
	    array('value'=>'200','label'=>'+200km')
);
 
$this->Template->inputRadius = $inputRadius;
...
 
?>

Anschließend kann, wie auch beim FormTextfeld(), das Feld an der gewünschten Position ausgegeben werden.

<?php echo $this->inputRadius->generateLabel();?>
<?php echo $this->inputRadius->generate();?>
Ansichten
Meine Werkzeuge

Contao Community Documentation

Nein, der Hangout ist noch nicht vorbei, wir schweigen nur. Es heisst ja auch hangout und nicht bryll out.

Christian Schiffler
Navigation
Verstehen
Verwenden
Entwickeln
Verschiedenes
Werkzeuge