* @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Form\Field; use Joomla\CMS\Form\FormField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Form Field class for the Joomla Platform. * Provides a grouped list select field. * * @since 1.7.0 */ class GroupedlistField extends FormField { /** * The form field type. * * @var string * @since 1.7.0 */ protected $type = 'Groupedlist'; /** * Name of the layout being used to render the field * * @var string * @since 4.0.0 */ protected $layout = 'joomla.form.field.groupedlist'; /** * Method to get the field option groups. * * @return array The field option objects as a nested array in groups. * * @since 1.7.0 * @throws \UnexpectedValueException */ protected function getGroups() { $groups = array(); $label = 0; foreach ($this->element->children() as $element) { switch ($element->getName()) { // The element is an