Hallo,
ich habe mir für das Frontend ein Custom Field erstellt vom Typ "Combo".
Über GetOptions lasse ich die Inhalte für die Auswahl laden und einfeügen.
Wenn aber das Feld angezeigt wird und man die Auswahl über den Button aufruft, kommt die Tabelle, es sind auch die richtige Anzahl Elemente enthalten, aber kein Text.
PHP
<?php
// No direct access to this file
defined ( '_JEXEC' ) or die ( 'Restricted access' );
jimport('joomla.form.formfield');
JFormHelper::loadFieldClass('combo');
/**
* Form Field class
*
* @since 0.0.1
*/
class JFormFieldAnsprpart extends JFormFieldCombo {
protected $type = 'Ansprpart';
/**
* Method to get a list of options for a combo input.
*
* @return array An array of JHtml options.
*/
public function getOptions() {
$db = JFactory::getDbo();
$query = $db->getQuery( true );
$query->select('*');
$query->from($db->qn('#__xxxxxxx'));
$query->where($db->qn('parent_id') . '=' . $db->q(JFactory::getUser()->id));
$db->setQuery( (string)$query );
if(JDEBUG)
echo $query->dump();
$rows = $db->setQuery($query)->loadObjectlist();
$options = [];
foreach($rows as $row){
$options[] = ['value'=>$row->vna . ' ' . $row->nna,'text'=>$row->vna . ' ' . $row->nna];
}
print_r($options);
return $options;
}
}
Alles anzeigen
Hat einer eine Idee woran das liegen könnte?
Nach meinen Recherchen baut sich das Feld mit Hilfe des JFormFieldList auf, das über "Options" seine Listenelemente hinzufügt.
Wandle ich das Feld in ein "List" um, kommen die Einträge auch mit Text.
Ich weiss nicht mehr weiter.