public function Embed::getEmbedObject in CKEditor Media Embed Plugin 8
Retrieve the Embed object as provided by the embed provider.
Parameters
string $url: The url to the media to request an embed object for.
Return value
object The decoded json object retrieved from the provided for the specified url.
Overrides EmbedInterface::getEmbedObject
1 call to Embed::getEmbedObject()
- Embed::processEmbeds in src/
Embed.php - Replace all oembed tags with the embed html based ona provider resource.
File
- src/
Embed.php, line 124
Class
- Embed
- The default CKEditor Media Embed class.
Namespace
Drupal\ckeditor_media_embedCode
public function getEmbedObject($url) {
$embed = NULL;
try {
$response = $this->httpClient
->get($this
->getEmbedProviderURL($url), [
'headers' => [
'content-type' => 'application/json',
],
]);
$embed = json_decode($response
->getBody());
} catch (TransferException $e) {
$this->messenger
->addWarning($this
->t('Unable to retrieve @url at this time, please check again later.', [
'@url' => $url,
]));
watchdog_exception('ckeditor_media_embed', $e);
}
$this->moduleHandler
->alter('ckeditor_media_embed_object', $embed);
return $embed;
}