- πΈπ°Slovakia kaszarobert
Needs a reroll since 2 years have passed and the module changed a little bit.
- π«π·France Nicolas S. Lyon, France
Here is a new patch to apply to current 4.x version
- Status changed to Needs review
about 1 year ago 3:13pm 17 October 2023 - Status changed to Needs work
12 months ago 8:48am 12 January 2024 - πΈπ°Slovakia kaszarobert
Because the module has changed a bit, a new approach should be set:
- the result in$oembedResult = $source->getMetadata($media, 'html');
is no longer a#markup
but a render array. Where'#is_iframe'
is TRUE if someone uses the Oembed API, and FALSE if someone uses Embedded Posts.
- For the Oembed API, the current approach of string replace should be fine.
- For Embedded Posts, the $oembedResult is going to be a render array like this:$oembedResponse['html'] = [ '#theme' => 'media_entity_facebook', '#url' => $resource_url, '#script_attributes' => $scriptAttributes, '#is_iframe' => $isIFrame, '#fb_sdk_langcode' => $fbLangcode, ]; $oembedResponse['author_name'] = 'Facebook'; $oembedResponse['width'] = '500'; $oembedResponse['height'] = 'auto'; $oembedResponse['url'] = $resource_url; return $oembedResponse;
The hardcoded width should be altered in FacebookEmbedFormatter::viewElements() in $oembedResult. And also, a new '#data-width' parameter should be added to the render array, to media_entity_facebook_theme() hook, and web/modules/contrib/media_entity_facebook/templates/media-entity-facebook.html.twig template so that the data-width value is rendered properly.