Support WYSIWYG embedding

Created on 31 December 2024, 4 months ago

We should be able to embed Codepens in WYSIWYG using Simple oEmbed for the filter, and oEmbed Providers to add the CodePen provider.

However, there is a little hook needed to add ?format=json to the resource url:

/**
 * Implements hook_oembed_resource_url_alter().
 */
function mglaman_dev_oembed_resource_url_alter(array &$parsed_url, \Drupal\media\OEmbed\Provider $provider) {
  if ($provider->getName() === 'Codepen') {
    $parsed_url['query']['format'] = 'json';
  }
}

(From mglaman: https://mglaman.dev/blog/adding-codepen-oembeds-your-drupal-site)

With this configuration plus the hook, I'm able to embed Codepens within WYSIWYG content.

I'm not sure if this module is an appropriate place for this code, but it is an easy addition if it makes sense.

✨ Feature request
Status

Active

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024