You are here

function fonts_com_fontyourface_enable in @font-your-face 7.2

Implements hook_fontyourface_enable().

File

modules/fonts_com/fonts_com.module, line 729

Code

function fonts_com_fontyourface_enable($font) {
  module_load_include('inc', 'fonts_com', 'api');
  $project = variable_get('fonts_com_project', '');
  $metadata = unserialize($font->metadata);
  if ($project == '') {
    drupal_set_message(t('Please !selectproject before enabling <i>@font</i>.', array(
      '!selectproject' => l('select a project', 'admin/config/user-interface/fontyourface/fonts_com/project'),
      '@font' => $font->name,
    )), 'error');
    return FALSE;
  }
  elseif (fonts_com_add_font_to_project($metadata['details']->FontID, $project)) {
    $metadata['project_id'] = $project;
    $font->metadata = serialize($metadata);
    fontyourface_save_font($font, TRUE);
    return TRUE;
  }

  // elseif
  return FALSE;
}