The Needs Review Queue Bot → tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to Needs review
about 2 years ago 7:51am 2 February 2023 - Status changed to Needs work
about 2 years ago 8:26am 2 February 2023 - 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
Deprecation messages should be updated for 10.1 and removal in 11.0.
Still needs issue summary & title update
- 🇮🇳India _utsavsharma
Tried to address the deprecated message update as per #71.
- Status changed to RTBC
about 2 years ago 12:22pm 20 February 2023 - 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Update issue status because _utsavsharma seems to fix the borisson_ petition.
Working for us. Review and tested on Drupal 9.5.3 - 🇧🇪Belgium davidiio
Patch failed to apply on D10 but I could make it work on D10 by copy/pasting same code at different line numbers in files. Also I could not find this test file in D10.1 :
/core/modules/media/tests/src/Kernel/ResourceFetcherTest.php
- Status changed to Needs work
about 2 years ago 2:17pm 22 February 2023 The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to Needs review
about 2 years ago 6:15am 23 February 2023 - 🇮🇳India mrinalini9 New Delhi
Rerolled patch #72 for 10.1.x branch, please review it.
Thanks!
- Status changed to Needs work
about 2 years ago 7:38am 23 February 2023 The Needs Review Queue Bot → tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to Needs review
about 2 years ago 6:34am 27 February 2023 - Status changed to Needs work
about 2 years ago 8:56am 27 February 2023 - 🇫🇮Finland sokru
As per 🌱 Replace strpos/substr with PHP 8's str_starts_with() / str_contains() / str_ends_with() Active , we should replace
strpos() !== FALSE
withstr_contains()
. The patch on #78 uses twicestrpos
that should be replaced. Otherwise looks good to me. - 🇮🇳India Akram Khan Cuttack, Odisha
added updated patch address #80
- Status changed to Needs review
about 2 years ago 2:47pm 27 February 2023 - Status changed to Needs work
about 2 years ago 3:57pm 16 March 2023 - 🇺🇸United States smustgrave
Still needs issue summary and title updates per #58 and #71
- last update
almost 2 years ago 28,524 pass - 🇯🇵Japan u7aro Japan
The #88 patch is working on my Drupal 10.1 project. Thanks!
- last update
over 1 year ago 30,144 pass, 2 fail - last update
over 1 year ago 30,149 pass - 🇮🇳India vsujeetkumar Delhi
After re-run the test on #90, all tests are passed now, Still needs to work on #86, So keep it same as 'Needs work'.
- last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago 30,169 pass - 🇺🇸United States brobert7
Upvoting a generic version of the hook: hook_media_source_metadata_alter. I currently have a use case for it, was reading through this thread getting hopeful that the patches would have gone that direction, but I see just the oembed specific hook has been created for now. I was able to install the patch as it is now, and the oembed hooks work, so thats cool, good work! They just don't work with non-oembed media items which is a bummer for my use case.
- 🇳🇱Netherlands seanB Netherlands
The latest version of the MR added changes to allow us to add the alter hook in
MediaSourceBase::getMetadata
. That still needs to be implemented in the MR though.If we want to allow dynamic attributes to be mapped in the interface we also need to change
getMetadataAttributes
. The idea was to move the metadata attributes to the plugin annotation, and havegetMetadataAttributes
return whatever attributes are configured in the annotation. The annotations can then be altered viahook_media_source_info_alter
.That being said, technically you can already override the media source plugin class using
hook_media_source_info_alter
and overridegetMetadataAttributes
andgetMetadata
for a specific media source. Which kind of makes me wonder if we need to implement this new hook at all. Although I know that lots of people probably find hooks much easier to implement than overriding a plugin class 🤔. - 🇨🇦Canada ambient.impact Toronto
I'm assuming you meant 10.1.6 because 10.6.x doesn't exist yet. 😉
- 🇨🇦Canada ambient.impact Toronto
Ambient.Impact → changed the visibility of the branch 11.x to hidden.
- 🇨🇦Canada ambient.impact Toronto
Created a new branch against 11.x because trying to rebase the old one onto it was a nightmare; reapplied the latest patch, merging in core changes as needed; also hiding the existing patches - download the patch from GitLab diff pls.
- 🇺🇸United States loze Los Angeles
@Ambient.Impact I may be missing something but I cant seem to download a patch for your branch. I think you need to create a MR for it?
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Based on the suggestion made on #86, I am adapting the title and description of the issue.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Pending to implements hook "hook_media_source_metadata_alter" on MR https://git.drupalcode.org/project/drupal/-/merge_requests/1614 add tests coverage and API documentation.
- 🇮🇹Italy dgsiegel
Upload loze's patch from #99 in order to use it with composer patches.
- last update
12 months ago 29,719 pass, 1 fail - 🇨🇦Canada puregin
Updating the patch from #103 (thanks crmn and all!).
- 🇨🇦Canada ambient.impact Toronto
Rerolled the patch because the previous couple of patches broke
Drupal\Tests\media\Functional\testResourceDataAlter()
; notable changes:- Fixed this syntax error that snuck in; see if you can spot it ;) :
$resource_url = $this->container->get('media.oembed.resource_fetcher')+ ->fetchResource('https://publish.twitter.com/oembed?url=https://twitter.com/Dries/status/999985431595880448');
- Added
void
return type totestResourceDataAlter()
for consistency with other core changes to tests.
- Fixed this syntax error that snuck in; see if you can spot it ;) :
- 🇺🇸United States smustgrave
Seems the title update and issue summary update are still needed.
Also fixes should be in MRs vs patches.
- 🇺🇸United States DamienMcKenna NH, USA
For anyone who needs it, this is #106 rerolled for 10.2.x.
- 🇺🇸United States DamienMcKenna NH, USA
FYI here's how I'm using the hook to remove the width and height from the iframe, so that its display can be managed using CSS.
/** * Implements hook_oembed_resource_data_alter(). */ function mymodule_oembed_resource_data_alter(array &$data, $url) { // @see https://www.drupal.org/project/drupal/issues/3042423 if (str_contains($url, 'youtube.com/oembed')) { // Remove the width and height attributes from the oembed iframe so that // they can be set via CSS. Note; do not remove the thumbnail width and // height as they are required. unset($data['width']); unset($data['height']); $data['html'] = str_replace([' width="200"', ' height="113"'], '', $data['html']); } }
- First commit to issue fork.
- Merge request !10865Issue #3042423: Add a hook to modify oEmbed resource data → (Open) created by Unnamed author
- 🇬🇧United Kingdom aurora-norris
Created a MR against 11.x but that won't apply properly to core 11.1.x so heres a patch that will work on that (tests are now using OOP hooks).
- 🇬🇧United Kingdom aurora-norris
Opened an updated MR for this project but that has conflicts against 11.1 so heres a patch for that too (now using an OOP hook in the test).
- 🇺🇸United States DamienMcKenna NH, USA
aurora-norris: FYI your comments weren't visible because your account wasn't approved and the automated security systems on the site don't let you post patches until your account is confirmed. I've confirmed your account and have published your two comments (though the second one is a dupe).
- 🇷🇺Russia nortmas Crimea/Thailand
Can anyone please reroll the patch for the 10.4.1?
- 🇫🇷France duaelfr Montpellier, France
Here is a patch for composer that applies on 11.x