You are here

function fontsquirrel_list in @font-your-face 6

5 calls to fontsquirrel_list()
fontsquirrel_fontyourface_css in modules/fontsquirrel/fontsquirrel.module
Implements hook_fontyourface_css().
fontsquirrel_fontyourface_enable in modules/fontsquirrel/fontsquirrel.module
Implements hook_fontyourface_enable().
fontsquirrel_fontyourface_info in modules/fontsquirrel/fontsquirrel.module
Implements hook_fontyourface_info().
fontsquirrel_fontyourface_license in modules/fontsquirrel/fontsquirrel.module
Implements hook_fontyourface_license().
fontsquirrel_preprocess_page in modules/fontsquirrel/fontsquirrel.module
Implements template_preprocess_page().

File

modules/fontsquirrel/fontsquirrel.module, line 336

Code

function fontsquirrel_list($show_error = TRUE) {
  static $fonts = FALSE;
  if ($fonts === FALSE) {
    $fonts = array();
    $font_fid_to_name = array();
    $results = db_query('SELECT g.* FROM {fontsquirrel_group} g');
    while ($result = db_fetch_object($results)) {
      $fonts[$result->name] = array(
        'path' => $result->path,
        'foundry' => $result->foundry_name,
        'foundry_path' => $result->foundry_path,
        'fonts' => array(),
      );
      $fonts[$result->name]['fonts'][$result->name] = array(
        'id' => $result->gid,
        'path' => $result->path,
        'filename' => $result->filename,
        'family' => $result->font_family,
        'local' => isset($result->local) ? $result->local : '',
      );
    }

    // while
    if (count($fonts) == 0 && $show_error) {
      drupal_set_message(t('The Font Squirrel font list has not yet been imported. !importlink or wait until the next cron run.', array(
        '!importlink' => l('Import now', 'admin/build/themes/fontyourface/fontsquirrel/import', array(
          'query' => drupal_get_destination(),
        )),
      )));
    }

    // if
  }

  // if
  return $fonts;
}