public \Joomla\CMS\Form\Field\ListField
addOption
(mixed $text, mixed $attributes = array())
/**
* Method to add an option to the list field.
*
* @param string $text Text/Language variable of the option.
* @param array $attributes Array of attributes ('name' => 'value' format)
*
* @return ListField For chaining.
*
* @since 3.7.0
*/
public function addOption($text, $attributes = array())
{
if ($text && $this->element instanceof \SimpleXMLElement) {
$child = $this->element->addChild('option', $text);
foreach ($attributes as $name => $value) {
$child->addAttribute($name, $value);
}
}
return $this;
}