You are here

function fontyourface_count_fonts in @font-your-face 7.2

Returns the number of fonts that exist in the database.

Parameters

string $provider: (optional) Filter by provider (e.g. 'google_fonts_api').

bool $status: (optional) Filter by status of the font (NULL = all, TRUE = enabled, FALSE = disabled).

3 calls to fontyourface_count_fonts()
fontyourface_add_theme_info_fonts in ./fontyourface.module
Load and display fonts that have been added through THEMENAME.info.
fontyourface_fyf_import in drush/fontyourface.drush.inc
Callback for Drush command 'fyf-import'.
fontyourface_fyf_status in drush/fontyourface.drush.inc
Callback for Drush command 'fyf-status'.

File

./fontyourface.module, line 137

Code

function fontyourface_count_fonts($provider = NULL, $status = NULL) {
  $query = db_select('fontyourface_font', 'fonts');
  $query
    ->fields('fonts');
  if (!empty($provider)) {
    $query
      ->condition('provider', $provider);
  }

  // if
  if (!empty($status)) {
    $query
      ->condition('enabled', (int) $status);
  }

  // if
  $count = $query
    ->execute()
    ->rowCount();
  return $count;
}