You are here

function fontyourface_views_pre_render in @font-your-face 7

Same name and namespace in other branches
  1. 8.3 fontyourface.module \fontyourface_views_pre_render()
  2. 6.2 fontyourface.module \fontyourface_views_pre_render()

Implements hook_views_pre_render().

File

./fontyourface.module, line 76

Code

function fontyourface_views_pre_render(&$view) {
  if ($view->name == 'fontyourface_disabled') {
    $breadcrumb = drupal_get_breadcrumb();
    $breadcrumb[] = l('@font-your-face', 'admin/appearance/fontyourface');
    drupal_set_breadcrumb($breadcrumb);
    $providers = module_implements('fontyourface_info');
    if (count($providers) == 0) {
      drupal_set_message(t('No font providers enabled. !enable before adding fonts.', array(
        '!enable' => l(t('Enable font providers'), 'admin/modules'),
      )), 'error');
    }

    // if
    foreach (module_implements('fontyourface_info') as $module) {
      $has_fonts = db_query_range("SELECT fid FROM {fontyourface_font} WHERE provider = :provider", 0, 1, array(
        ':provider' => $module,
      ))
        ->fetchObject();
      if (!$has_fonts) {
        $function = $module . '_fontyourface_info';
        $info = $function();
        drupal_set_message(t('@provider currently has no fonts. This is probably because the import has not been run yet. !import to add fonts.', array(
          '@provider' => $info['name'],
          '!import' => l(t('Run import'), 'admin/config/user-interface/fontyourface'),
        )), 'error');
      }

      // if
    }

    // foreach
  }

  // if
}