You are here

function fontyourface_ui_theme_instructions in @font-your-face 7.2

Provides instructions for placing fonts in theme.

1 call to fontyourface_ui_theme_instructions()
fontyourface_ui_apply_page in modules/fontyourface_ui/fontyourface_ui.module
Admin page shows enabled fonts with options to add.

File

modules/fontyourface_ui/fontyourface_ui.module, line 1042

Code

function fontyourface_ui_theme_instructions() {
  $info_declarations = array();
  $fonts = fontyourface_get_fonts('enabled = 1');
  foreach ($fonts as $font) {
    $provider_base_path = fontyourface_provider_info($font, 'base_path');
    $path = str_replace($provider_base_path, '', $font->url);
    if ($font->provider == 'local_fonts') {
      $info_declarations[] = '; ' . t("Local font '@font' can not be included in a theme.info file,", array(
        '@font' => $font->name,
      ));
      $info_declarations[] = '; ' . t('because it can not be loaded via URL.');
    }
    else {
      $info_declarations[] = 'fonts[' . $font->provider . '][] = "' . $path . '"';
    }

    // else
  }

  // foreach
  $instructions = array(
    'text' => array(
      '#markup' => '<p>' . t('!fyf can be used to load fonts in a Drupal theme. To add fonts to your Drupal theme, simply copy and paste the text below into your theme.info file. Until Drupal themes can declare dependencies on modules, you will also need to inform users of the need to enable !fyf.', array(
        '!fyf' => '@font-your-face',
      )) . '</p>',
    ),
    'info' => array(
      '#markup' => '<div><textarea rows="10" cols="100">' . implode("\n", $info_declarations) . '</textarea></div>',
    ),
  );
  return $instructions;
}