You are here

function google_webfont_loader_api_site_settings in Webfont Loader 6

Same name and namespace in other branches
  1. 7 google_webfont_loader_api.admin.inc \google_webfont_loader_api_site_settings()

Form sets what the google webfont loader api will load upon startup.

1 string reference to 'google_webfont_loader_api_site_settings'
google_webfont_loader_api_menu in ./google_webfont_loader_api.module
Implements hook_menu().

File

./google_webfont_loader_api.admin.inc, line 11
The form which allows for user settings on the webfont loader api.

Code

function google_webfont_loader_api_site_settings($form_state = array()) {
  $form = array();
  $listing = google_webfont_loader_api_get_font_list(TRUE);
  $fonts = array(
    '' => 'n/a - use default theme font',
  );
  foreach ($listing as $list_item) {
    $fonts[$list_item->name] = check_plain($list_item->info['name']);
  }
  $form['google_webfont_loader_api_font'] = array(
    '#type' => 'select',
    '#title' => t('Font'),
    '#description' => t('Use the google webfont loader api to add a font styling to the site.'),
    '#options' => $fonts,
    '#default_value' => variable_get('google_webfont_loader_api_font', ''),
  );
  $form['google_webfont_loader_api_cache'] = array(
    '#type' => 'checkbox',
    '#title' => t('Cache Webfont Loader file locally'),
    '#description' => t("If checked, the webfont loader api is retrieved and cached locally. It is updated daily from Google's servers to ensure updates to code are reflected in the local copy."),
    '#default_value' => variable_get('google_webfont_loader_api_cache', 0),
  );
  $doc_link = l(t('google webfont docs'), 'https://code.google.com/apis/webfonts/docs/webfont_loader.html', array());
  $form['google_webfont_loader_api_display_style'] = array(
    '#type' => 'radios',
    '#title' => t('Font Loading Style'),
    '#description' => t('Select default if you wish for the font to get
                        displayed even though it may not yet have loaded (or however you define it in your render stylesheets). This provides you with control on how you want the fonts to behave
                        and this is useful if you want the users to see text
                        regardless of the current loaded status of the font.
                        Choose hidden if you want the page to display only after
                        the fonts have been loaded on the page. Please read the
                        !link or the contents of the README.txt file for
                        more information on how to format your CSS', array(
      '!link' => $doc_link,
    )),
    '#default_value' => variable_get('google_webfont_loader_api_display_style', ''),
    '#options' => array(
      '' => t('default'),
      'hidden' => t('hidden'),
    ),
  );
  return system_settings_form($form);
}