You are here

function fontyourface_admin_page in @font-your-face 6

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

Admin page shows enabled fonts with link to add.

1 string reference to 'fontyourface_admin_page'
fontyourface_menu in ./fontyourface.module
Implements hook_menu().

File

./fontyourface.module, line 191

Code

function fontyourface_admin_page() {
  $fonts = fontyourface_get_fonts();
  $available_fonts = fontyourface_available_fonts();
  $rows = array();
  if (empty($fonts)) {
    $rows[] = array(
      array(
        'data' => t('No fonts added.'),
        'colspan' => '3',
      ),
    );
  }
  else {
    foreach ($fonts as $font) {
      if (module_exists($font->provider)) {
        $provider = l($available_fonts[$font->provider]['name'], $available_fonts[$font->provider]['url']);
      }
      else {
        $provider = '<i class="error">Disabled</i>';
      }

      // else
      $rows[] = array(
        $font->name,
        $provider,
        l('Edit', 'admin/build/themes/fontyourface/edit/' . $font->fid),
      );
    }

    // foreach
  }

  // else
  $header = array(
    t('Name'),
    t('Provider'),
    t('Operations'),
  );
  return theme('table', $header, $rows, array(
    'id' => 'font-your-face',
  )) . '<div>' . l('Add a new font', 'admin/build/themes/fontyourface/add') . '</div>';
}