'#options' => TimeZoneFormHelper::
getOptionsListByRegion($account->
id() !=
$user->
id()),
'#description' =>
$this->
t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'
),
];
// If not set or selected yet, detect timezone for the current user only.
$user_input =
$form_state->
getUserInput();
if (!
$account->
getTimezone() &&
$account->
id() ==
$user->
id() &&
empty($user_input['timezone'
])) { $form['timezone'
]['#attached'
]['library'
][] = 'core/drupal.timezone';
$form['timezone'
]['timezone'
]['#attributes'
] =
['class' =>
['timezone-detect'
]];
} return parent::
form($form,
$form_state);
} /**
* {@inheritdoc}
*/
public static function trustedCallbacks() { return ['alterPreferredLangcodeDescription'
];
} /**
* Alters the preferred language widget description.
*
* @param array $element
* The preferred language form element.
*
* @return array
* The preferred language form element.
*/