You are here

function _bootstrap_library_cdn_versions in Bootstrap Library 8

Load CDN version optios.

File

src/BootstrapLibrarySettingsForm.php, line 343
Contains \Drupal\bootstrap_library\BootstrapLibrarySettingsForm

Namespace

Drupal\bootstrap_library

Code

function _bootstrap_library_cdn_versions() {
  static $uri = 'http://netdna.bootstrapcdn.com/data/bootstrapcdn.json';
  $json_response = NULL;
  try {
    $client = \Drupal::httpClient();
    $response = $client
      ->get($uri, array(
      'headers' => array(
        'Accept' => 'text/plain',
      ),
    ));
    $data = (string) $response
      ->getBody();
    if (empty($data)) {
      return FALSE;
    }
  } catch (RequestException $e) {
    watchdog_exception('bootstrap_library', $e
      ->getMessage());
    return FALSE;
  }
  return $data;
}