/** * @param $region The region for which to fetch a list of realms. * @param $realm The currently selected realm (if any). * * @return string A string of html option elements to display within a select element. */ public function get_realms_options($region, $current_realm = null) { $realms_for_region = WoW_Armory_Character_DAL::fetch_realms($region); if (!$realms_for_region instanceof WP_Error) { return $realms_for_region->get_realms_as_options($current_realm); } }
public function admin_ajax_realms() { $region = htmlspecialchars($_POST['region']); $realms = WoW_Armory_Character_DAL::fetch_realms($region); echo $realms->get_realms_as_options(); // needed on ajax endpoints die; }