Back to TextField class

Method getOptions

protected array
getOptions
()
Method to get the field options.
Returns
  • array The field option objects.
Since
  • 3.4
Class: TextField
Project: Joomla

Method getOptions - Source code

/**
 * Method to get the field options.
 *
 * @return  array  The field option objects.
 *
 * @since   3.4
 */
protected function getOptions()
{
    $options = array();
    foreach ($this->element->children() as $option) {
        // Only add <option /> elements.
        if ($option->getName() !== 'option') {
            continue;
        }
        // Create a new option object based on the <option /> element.
        $options[] = HTMLHelper::_('select.option', (string) $option['value'], Text::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text');
    }
    return $options;
}