You are here

function _user_entity_diff_additional_options_timezone in Diff 7.3

Private callback function to render the timezone field.

File

includes/user.inc, line 88
Provide diff functions for the user module.

Code

function _user_entity_diff_additional_options_timezone($old_user, $new_user, $context) {
  $row = array(
    '#name' => t('Time zone'),
    '#states' => array(),
    '#weight' => -1,
    '#settings' => array(),
  );
  $system_time_zones = system_time_zones(TRUE);
  $old_zone = isset($old_user->timezone) ? $old_user->timezone : '';
  $new_zone = isset($new_user->timezone) ? $new_user->timezone : '';
  foreach ($context['states'] as $state) {
    $row['#states'][$state] = array(
      '#old' => array(
        isset($system_time_zones[$old_zone]) ? $system_time_zones[$old_zone] : t('- None selected -'),
      ),
      '#new' => array(
        isset($system_time_zones[$new_zone]) ? $system_time_zones[$new_zone] : t('- None selected -'),
      ),
    );
  }
  return $row;
}