You are here

function fonts_com_add_domain in @font-your-face 7.2

Adds a single domain to a project.

1 call to fonts_com_add_domain()
fonts_com_save_domains_in_project in modules/fonts_com/api.inc
Saves list of domains in a given project.

File

modules/fonts_com/api.inc, line 332
API functions.

Code

function fonts_com_add_domain($project_id, $domain_name) {
  $path = '/rest/json/Domains/?wfspid=' . $project_id;
  $response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, array(
    'headers' => fonts_com_api_headers($path),
    'method' => 'POST',
    'data' => 'wfsdomain_name=' . $domain_name,
  ));
  if ($response->code == 200) {
    return TRUE;
  }
  else {
    drupal_set_message(t('There was an error adding a domain (@domain) in a project (@project) on Fonts.com.', array(
      '@domain' => $domain_name,
      '@project' => $project_id,
    )), 'error');
    fontyourface_log('Invalid drupal_http_request response: @response', array(
      '@response' => print_r($response, TRUE),
    ));
  }

  // else
  return FALSE;
}