You are here

function fontyourface_admin_edit_form in @font-your-face 6

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

Edit form changes CSS selector or disables a single font.

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

File

./fontyourface.module, line 461

Code

function fontyourface_admin_edit_form(&$form_state, $fid) {
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l('@font-your-face', 'admin/build/themes/fontyourface');
  drupal_set_breadcrumb($breadcrumb);
  $font = new stdClass();
  $font->fid = $fid;
  $font = fontyourface_get_font($font);
  $css_function = $font->provider . '_fontyourface_css';
  if (function_exists($css_function)) {
    $font_css = $css_function($font);
  }

  // if
  $form = array(
    'fid' => array(
      '#type' => 'hidden',
      '#value' => $font->fid,
    ),
    'font_name' => array(
      '#value' => '<h2>' . check_plain($font->name) . '</h2>',
    ),
    'css' => array(
      '#type' => 'textarea',
      '#title' => t('CSS selector'),
      '#default_value' => $font->css,
      '#description' => t('Use commas to separate multiple selectors, just like you would in CSS. Leave blank to handle application of the font in your theme.'),
    ),
  );
  if ($font_css) {
    $form += array(
      'font-family' => array(
        '#value' => '<div>' . t('To apply in your own CSS, use:') . '</div><div><code>font-family: ' . check_plain($font_css['font-family']) . ';</code></div>',
      ),
    );
  }

  // if
  $form += array(
    'buttons' => array(
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Edit font'),
      ),
      'delete' => array(
        '#type' => 'submit',
        '#value' => t('Disable'),
      ),
    ),
  );
  return $form;
}