Undocumented Loader::helper('lists/countries'); ????

Permalink
Hi,

Can someone tell me what this does or how this works?
<?php $co = Loader::helper('lists/countries'); 
...
$countriesTmp = $co->getCountries();
$countries = array();
foreach($countriesTmp as $_key => $_value) {
   if ((!$akHasCustomCountries) || ($akHasCustomCountries && in_array($_key, $akCustomCountries))) {
      $countries[$_key] = $_value;
   }
}
?>


The only docs I can find say "helper" is shorthand to load a class instance. I can find no Class Lists or Class countries and nothing with a member GetCountries() in any of the source.

This came from code in concrete/attributes/address if that helps. I am trying to create my own attribute set that allows the user to select from <select> controls like State/Provence in the address attribute.

Thanks,
Sean

 
ob7dev replied on at Permalink Reply
ob7dev
What c5 version are you using?
SeanDevoy replied on at Permalink Reply
ooops, sorry. 5.7.5.9
ob7dev replied on at Permalink Reply 1 Attachment
ob7dev
It appears to return a list of countries as country code => value, I attached a screenshot of it echoed to DOM.

Also Loader::helper is deprecated so it may be difficult to use, its been replaced by Core::make, so the following code would be replacement:
Core::make('helper/lists/countries')
. Check of the EC developer tools plugin, it has API links for all the helper classes so you can read up on what they do from the c5 api docs.
SeanDevoy replied on at Permalink Reply
Thanks ob7dev. But i could see what the final output was. I was more interested in how that part of the code works? Granted, I did say "What this does", sorry for the confusion.
SeanDevoy replied on at Permalink Reply
Thanks for the EC Dev Tools tip! I found the Localization service with countries and state_province functions!!

Told me everything I was after!
ob7dev replied on at Permalink Reply
ob7dev
Oh nice! I just finished making a video for you
http://archebian.org/videos/ec-c5-namespaces.mp4...

But you've already figured it out!