You are here

private function OEmbedFilter::getContents in Gutenberg 8

Get contents.

Locally create HTML after pattern study for sites that don't support oEmbed.

1 call to OEmbedFilter::getContents()
OEmbedFilter::embed in src/Plugin/Filter/OEmbedFilter.php
Callback function to process each URL.

File

src/Plugin/Filter/OEmbedFilter.php, line 160

Class

OEmbedFilter
Class OEmbedFilter.

Namespace

Drupal\gutenberg\Plugin\Filter

Code

private function getContents($provider, $url) {
  $width = $this->settings['oembed_maxwidth'];
  switch ($provider) {
    case 'google-maps':
      $height = (int) ($width / 1.3);
      $embed = "<iframe width='{$width}' height='{$height}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='{$url}&output=embed'></iframe><br /><small><a href='{$url}&source=embed' style='color:#0000FF;text-align:left'>View Larger Map</a></small>";
      break;
    case 'google-docs':
      $height = (int) ($width * 1.5);
      $embed = "<iframe width='{$width}' height='{$height}' frameborder='0' src='{$url}&widget=true'></iframe>";
      break;
    default:
      $embed = $url;
  }
  return $embed;
}