You are here

function countryicons_get_iconsets in Country Icons 7

Same name and namespace in other branches
  1. 6.2 countryicons.module \countryicons_get_iconsets()
  2. 6 countryicons.module \countryicons_get_iconsets()
  3. 7.2 countryicons.module \countryicons_get_iconsets()

Get all iconsets and their details. Searches for .iconsetsinfo-files within the modules iconsets directory.

Return value

array of iconsets

1 call to countryicons_get_iconsets()
countryicons_get_iconset in ./countryicons.module
Get an iconsets details.

File

./countryicons.module, line 80
A collection of country icons, and an API for retrieving them.

Code

function countryicons_get_iconsets() {
  static $all_iconsets = NULL;
  if (isset($all_iconsets)) {
    return $all_iconsets;
  }
  $all_iconsets = array();
  $iconsetpath = drupal_get_path('module', 'countryicons') . '/iconsets';
  $setinfofiles = file_scan_directory($iconsetpath, '/.iconsetinfo/', array(
    'key' => 'name',
  ));
  foreach ($setinfofiles as $setinfofile) {
    $setinfo = drupal_parse_info_file($setinfofile->uri);
    $setinfo['path'] = $iconsetpath . '/' . $setinfo['name'] . '/*.' . $setinfo['format'];
    $all_iconsets[$setinfo['name']] = $setinfo;
  }
  return $all_iconsets;
}