Back to Select class

Method booleanlist

public static string
booleanlist
(mixed $name, mixed $attribs = array(), mixed $selected = null, mixed $yes = 'JYES', mixed $no = 'JNO', mixed $id = false)
Generates a yes/no radio list.
Parameters
  • string $name The value of the HTML name attribute
  • array $attribs Additional HTML attributes for the `<select>` tag
  • string $selected The key that is selected
  • string $yes Language key for Yes
  • string $no Language key for no
  • mixed $id The id for the field or false for no id
Returns
  • string HTML for the radio list
Since
  • 1.5
-
  • \Joomla\CMS\Form\Field\RadioField
Class: Select
Project: Joomla

Method booleanlist - Source code

/**
 * Generates a yes/no radio list.
 *
 * @param   string  $name      The value of the HTML name attribute
 * @param   array   $attribs   Additional HTML attributes for the `<select>` tag
 * @param   string  $selected  The key that is selected
 * @param   string  $yes       Language key for Yes
 * @param   string  $no        Language key for no
 * @param   mixed   $id        The id for the field or false for no id
 *
 * @return  string  HTML for the radio list
 *
 * @since   1.5
 * @see     \Joomla\CMS\Form\Field\RadioField
 */
public static function booleanlist($name, $attribs = array(), $selected = null, $yes = 'JYES', $no = 'JNO', $id = false)
{
    $arr = array(HTMLHelper::_('select.option', '0', Text::_($no)), HTMLHelper::_('select.option', '1', Text::_($yes)));
    return HTMLHelper::_('select.radiolist', $arr, $name, $attribs, 'value', 'text', (int) $selected, $id);
}