public function countries() { $countries = parent::countries(); foreach ($countries as $index => $country) { if (isset($this->beans_company_update_result->data->settings->company_address_country) and $country['code'] == $this->beans_company_update_result->data->settings->company_address_country) { $countries[$index]['selected'] = TRUE; } else { $countries[$index]['selected'] = FALSE; } } return $countries; }
public function countries() { $default_country = "US"; $settings = parent::beans_settings(); $return_array = parent::countries(); if ($settings and isset($settings->company_address_country) and strlen($settings->company_address_country)) { $default_country = $settings->company_address_country; } foreach ($return_array as $index => $country) { $return_array[$index]['default'] = $country['code'] == $default_country ? TRUE : FALSE; } return $return_array; }