You are here

function kernest_list in @font-your-face 6

4 calls to kernest_list()
kernest_fontyourface_css in modules/kernest/kernest.module
Implements hook_fontyourface_css().
kernest_fontyourface_info in modules/kernest/kernest.module
Implements hook_fontyourface_info().
kernest_fontyourface_license in modules/kernest/kernest.module
Implements hook_fontyourface_license().
kernest_preprocess_page in modules/kernest/kernest.module
Implements template_preprocess_page().

File

modules/kernest/kernest.module, line 208

Code

function kernest_list($show_error = TRUE) {
  static $fonts = FALSE;
  if ($fonts === FALSE) {
    $fonts = array();
    $font_fid_to_name = array();
    $results = db_query('SELECT k.* FROM {kernest} k');
    while ($result = db_fetch_object($results)) {
      if (!isset($fonts[$result->foundry])) {
        $fonts[$result->foundry] = array(
          'path' => urlencode($result->foundry),
          'fonts' => array(),
        );
      }

      // if
      $fonts[$result->foundry]['fonts'][$result->name] = array(
        'name' => $result->name,
        'path' => urlencode($result->name),
        'css' => $result->css,
        'license' => array(
          'name' => $result->license,
          'url' => $result->license_url,
        ),
        'url' => $result->url,
      );
    }

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

    // if
  }

  // if
  return $fonts;
}