You are here

protected function Soundcloud::oEmbed in Media entity Soundcloud 8

Returns oembed data for a Soundcloud url.

Parameters

string $url: The Soundcloud Url.

Return value

array An array of oembed data.

1 call to Soundcloud::oEmbed()
Soundcloud::getField in src/Plugin/MediaEntity/Type/Soundcloud.php
@inheritDoc

File

src/Plugin/MediaEntity/Type/Soundcloud.php, line 210

Class

Soundcloud
Provides media type plugin for Soundcloud.

Namespace

Drupal\media_entity_soundcloud\Plugin\MediaEntity\Type

Code

protected function oEmbed($url) {
  $this->soundcloud =& drupal_static(__FUNCTION__ . hash('md5', $url));
  if (!isset($this->soundcloud)) {
    $url = 'https://soundcloud.com/oembed?format=json&url=' . $url;
    $response = $this->httpClient
      ->get($url);
    $this->soundcloud = json_decode((string) $response
      ->getBody(), TRUE);
  }
  return $this->soundcloud;
}