You are here

function fontyourface_ui_admin_enable_ajax in @font-your-face 7.2

Enables font based on POSTed fid.

1 string reference to 'fontyourface_ui_admin_enable_ajax'
fontyourface_ui_menu in modules/fontyourface_ui/fontyourface_ui.module
Implements hook_menu().

File

modules/fontyourface_ui/fontyourface_ui.module, line 1457

Code

function fontyourface_ui_admin_enable_ajax() {
  $fid = intval($_POST['fid']);
  $output = array(
    'fid' => $fid,
    'complete' => 0,
  );
  if ($fid > 0) {
    $font = fontyourface_get_font($fid);
    if (fontyourface_enable_font($font)) {
      drupal_set_message(t('Enabled @font.', array(
        '@font' => $font->name,
      )));
      $output['complete'] = 1;
    }

    // if
  }
  else {
    drupal_set_message(t('Font not found. Could not enable.'), 'error');
  }

  // else
  $output['status'] = theme_status_messages(array()) . '<p>' . fontyourface_ui_enabled_count() . '</p>';
  drupal_json_output($output);
}