Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292473

oEmbed system can't parse XML attributes

$
0
0

Problem/Motivation

Steps to reproduce:

Add this to a custom module:

function mymodule_media_source_info_alter(&$sources) {
  $sources['audio_oembed'] = [
    'id' => 'audio_oembed',
    'label' => t('Remote audio'),
    'description' => t('Use audio from remote sources.'),
    'allowed_field_types' => ['string'],
    'default_thumbnail_filename' => 'no-thumbnail.png',
    'providers' => ['SoundCloud'],
    'class' => 'Drupal\media\Plugin\media\Source\OEmbed',
  ];
}

Set up a media type using the source.

When you try to save a new media item pointing to soundcloud, you get the following error:

"The provided URL does not represent a valid oEmbed resource."

This is because soundcloud specifies type float for their oembed version, and Symfony's xml parser returns an array for floats.

Proposed resolution

Patch attached which makes it work, but not sure what the best solution is here.

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 292473

Trending Articles