You are here

function google_webfont_loader_api_get_font_list in Webfont Loader 6

Same name and namespace in other branches
  1. 8 google_webfont_loader_api.module \google_webfont_loader_api_get_font_list()
  2. 7 google_webfont_loader_api.module \google_webfont_loader_api_get_font_list()

Retrieves the list of available fonts.

2 calls to google_webfont_loader_api_get_font_list()
google_webfont_loader_api_init in ./google_webfont_loader_api.module
Implements hook_init().
google_webfont_loader_api_site_settings in ./google_webfont_loader_api.admin.inc
Form sets what the google webfont loader api will load upon startup.

File

./google_webfont_loader_api.module, line 110
Google Webfont Loader API primary file The designer/developer creates a set of packages (will use .fontinfo files created in a similar manner to a module or theme .info file) from which the site admin can then choose for their site. The fonts can…

Code

function google_webfont_loader_api_get_font_list($reset = FALSE) {

  // I am unsure of how expensive a call to drupal_system_listing is.  As such,
  // I am caching the font information.
  $listings = cache_get('google_webfont_loader_api_font_list');
  if ($reset || !$listings) {
    $listings = drupal_system_listing('\\.fontinfo', '');
    $font_list = array();
    foreach ($listings as $key => $listing) {
      $listing->info = drupal_parse_info_file($listing->filename);
    }
    cache_set('google_webfont_loader_api_font_list', $listings);
  }
  else {
    $listings = $listings->data;
  }
  return $listings;
}