You are here

function fontscom_api_publish_updated_project in @font-your-face 8.3

Updates fonts.com project package so updated font list is used.

Return value

bool True if projects updated successfully. FALSE otherwise.

2 calls to fontscom_api_publish_updated_project()
fontscom_api_add_font_to_current_project in modules/fontscom_api/fontscom_api.module
Adds font to fonts.com project package.
fontscom_api_remove_font_from_current_project in modules/fontscom_api/fontscom_api.module
Removes font from fonts.com project package.

File

modules/fontscom_api/fontscom_api.module, line 538
Fonts.com API module file.

Code

function fontscom_api_publish_updated_project() {
  try {
    $path = '/rest/json/Publish/';
    $uri = FONTSCOM_API_BASE_URL . $path;
    $response = \Drupal::httpClient()
      ->get($uri, [
      'headers' => fontscom_api_headers($path),
      'verify' => FALSE,
    ]);
    return TRUE;
  } catch (Exception $e) {
    Drupal::messenger()
      ->addMessage(t('There was an error publishing project on Fonts.com. Error: %error', [
      '%error' => Psr7\str($e
        ->getResponse()),
    ]), 'error');
    return FALSE;
  }
}