You are here

function fonts_com_get_selectors_in_project in @font-your-face 7.2

Gets selectors in project.

2 calls to fonts_com_get_selectors_in_project()
fonts_com_enable_from_active_project in modules/fonts_com/fonts_com.module
Enables fonts locally based on the current active project.
fonts_com_set_font_selector in modules/fonts_com/api.inc
Sets selector on font.

File

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

Code

function fonts_com_get_selectors_in_project($project_id) {
  $selectors = array();
  $path = '/rest/json/Selectors/?wfspid=' . $project_id;
  $response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, array(
    'headers' => fonts_com_api_headers($path),
  ));
  if ($response->code == 200) {
    $data = json_decode($response->data);
    if (isset($data->Selectors) && isset($data->Selectors->Selector)) {
      $selectors = fonts_com_unknown_to_array($data->Selectors->Selector);
    }

    // if
  }
  else {
    drupal_set_message(t('There was an error adding a CSS selector on Fonts.com.'), 'error');
    fontyourface_log('Invalid drupal_http_request response: @response', array(
      '@response' => print_r($response, TRUE),
    ));
  }

  // else
  return $selectors;
}