You are here

function local_fonts_form_alter in @font-your-face 7.2

Same name and namespace in other branches
  1. 6.2 modules/local_fonts/local_fonts.module \local_fonts_form_alter()
  2. 7 modules/local_fonts/local_fonts.module \local_fonts_form_alter()

Implements hook_form_alter().

File

modules/local_fonts/local_fonts.module, line 46

Code

function local_fonts_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'fontyourface_settings_form') {

    // Replace button with a link to the custom font form.
    $form['providers']['local_fonts_import']['import'] = array(
      '#type' => 'item',
      '#markup' => l(t('Import Local Font'), 'admin/config/user-interface/fontyourface/local_fonts'),
    );
  }
  elseif ($form_id == 'fontyourface_ui_admin_edit_form') {
    $font = fontyourface_get_font($form['fid']['#value']);

    // Add delete button for local fonts.
    if ($font->provider == 'local_fonts') {
      $form['buttons']['delete'] = array(
        '#type' => 'submit',
        '#value' => t('Delete font record'),
        '#submit' => array(
          'local_fonts_delete_button_submit',
        ),
      );
    }

    // if
  }

  // elseif
}