function fonts_com_add_font_to_project in @font-your-face 7.2
Adds font to project.
1 call to fonts_com_add_font_to_project()
- fonts_com_fontyourface_enable in modules/
fonts_com/ fonts_com.module - Implements hook_fontyourface_enable().
File
- modules/
fonts_com/ api.inc, line 457 - API functions.
Code
function fonts_com_add_font_to_project($font_id, $project_id) {
$path = '/rest/json/Fonts/?wfspid=' . $project_id;
$response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, array(
'headers' => fonts_com_api_headers($path),
'method' => 'POST',
'data' => 'wfsfid=' . $font_id,
));
if ($response->code == 200) {
$data = json_decode($response->data);
fonts_com_publish();
return TRUE;
}
else {
drupal_set_message(t('There was an error enabling the font on Fonts.com.'), 'error');
fontyourface_log('Invalid drupal_http_request response: @response', array(
'@response' => print_r($response, TRUE),
));
}
// else
return FALSE;
}