Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time Zone form field to use groupedlist fancy select layout #42774

Merged
merged 9 commits into from
Mar 4, 2024
1 change: 1 addition & 0 deletions administrator/components/com_config/forms/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@
label="COM_CONFIG_FIELD_SERVER_TIMEZONE_LABEL"
description="COM_CONFIG_FIELD_SERVER_TIMEZONE_DESC"
default="UTC"
layout="joomla.form.field.groupedlist-fancy-select"
>
<option value="UTC">JLIB_FORM_VALUE_TIMEZONE_UTC</option>
</field>
Expand Down
1 change: 1 addition & 0 deletions administrator/components/com_users/forms/user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
name="timezone"
type="timezone"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
layout="joomla.form.field.groupedlist-fancy-select"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
Expand Down
1 change: 1 addition & 0 deletions components/com_users/forms/frontend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
name="timezone"
type="timezone"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
layout="joomla.form.field.groupedlist-fancy-select"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
Expand Down
4 changes: 4 additions & 0 deletions libraries/src/Form/Field/TimezoneField.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Joomla\CMS\Form\Field;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
Expand Down Expand Up @@ -149,6 +150,9 @@ protected function getGroups()
}
}

// Add UTC option.
$groups['']['UTC'] = HTMLHelper::_('select.option', 'UTC', Text::_('JLIB_FORM_VALUE_TIMEZONE_UTC'), 'value', 'text', false);
cyrezdev marked this conversation as resolved.
Show resolved Hide resolved

// Sort the group lists.
ksort($groups);

Expand Down