/** * Adds timezone settings to the *General* settings tab. * * When it is determined that timezone data still needs to be generated for one or more * events then only the update tool will be exposed in this area, in all other cases this * is not exposed and the ordinary timezone settings will be visible. * * @param array $general_settings * * @return array */ public function settings_ui(array $general_settings) { $updater = new Tribe__Events__Admin__Timezone_Updater(); // Load all timezone settings $timezone_settings = $this->get_settings_array(); // Remove unneeded options: until timezone data has been updated, users should only see the update // button - after that point, they should see the "real" settings but not the update button if ($updater->update_needed()) { unset($timezone_settings['tribe_events_timezone_mode']); unset($timezone_settings['tribe_events_timezones_show_zone']); } else { unset($timezone_settings['tribe_events_enable_timezones']); } // Add the new section just before the settings form is closed return Tribe__Events__Main::array_insert_before_key('tribe-form-content-end', $general_settings, $timezone_settings); }