Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It doesn't look like there's a way align video on page when added from WYSIWYG editor
Comments
Comment #2
Sam152 CreditAttribution: Sam152 at PreviousNext commentedAt the moment, they should fill the full width of the page with responsive enabled. I haven't implemented any alignment, but have seen generally the trend in embedded videos to be full width. WYSIWYG alignment has always been somewhat finnicky so perhaps the apporach for videos with extended layout requirements should be a new field instead of the WYSIWYG integration. Thoughts?
Comment #3
Sam152 CreditAttribution: Sam152 at PreviousNext commentedComment #4
tjgillies CreditAttribution: tjgillies commentedI'm not sure what you mean by new field. A new field on the content? I have many videos in the article. Please forgive me, I'm rather new to Drupal. What I ended up doing was just using the embed code from youtube.com wrapped in a p tag with align=center. The downside to this is that the video extends past page width when viewed on mobile.
Comment #5
purushotam.rai CreditAttribution: purushotam.rai at QED42 commentedJust for a start on the alignment issue of video I have tried enabling support for alignment options for Video field and then passing this as option in renderEmbedCode() [ProviderPluginInterface] as optional parameter. This patch is not generic and needs work.
Comment #6
purushotam.rai CreditAttribution: purushotam.rai at QED42 commentedPatch for 8.x-3.x branch
Comment #7
vyasamit2007 CreditAttribution: vyasamit2007 as a volunteer and at Acquia commentedI would suggest the render
renderEmbedCode()
function should accept an array argument with height, width, align, fullscreen, autoplay, etc. and when we really render the iframe OR video, we should add all of them together. I know this means to change all the plugins we've built for YouTube, Vimeo, etc. but that is one time and this way we also support any no of attributes we could add to this. Thoughts?Comment #8
Sam152 CreditAttribution: Sam152 at PreviousNext commentedNope, the small settings are the interface providers must satisfy. Generic attributes don't fit into this or the 80% use-case that is being targeted. It was specifically engineered to make overriding on code very very easy for this reason.
Alignment is interesting, because it could be done at the wrapper level, not in the plugin, same with the responsive option. I think making this an option for the formatter is probably stepping too far into theming land, but an option for WYSIWYGs specifically could be on the cards, despite the design trend I've seen being full-width responsive, and thus satisfy the 80% use case automatically.
Comment #9
ashleyhazle CreditAttribution: ashleyhazle as a volunteer and commentedI was literally writing the same patch as I've been given a requirement to align videos (in the WYSIWYG) too.
I agree this probably isn't something for the formatter, but it's most definitely an expected WYSIWYG feature (even though it makes no sense for modern responsive sites).
I'm happy to have a look at this, but I don't follow you're thinking for a WYSIWYG specific feature. Could you provide a few more details?
Comment #10
ashleyhazle CreditAttribution: ashleyhazle as a volunteer and commentedTurns out our editors were happy with using Paragraphs for layout, so we don't need this anymore. Definitely a better way to work :)
Comment #11
fabianfiorotto CreditAttribution: fabianfiorotto commentedI updated purushotam's code to apply in the current branch 8.x-2.x. I also added an implementation that uses wrappers.
Comment #12
Sam152 CreditAttribution: Sam152 at PreviousNext commentedWith the advent of Media in core, the Video Embed Field module has moved to being minimally maintained. Only issues which assist in the migration to Media in core will be committed. To read more about this decision, please see: #3089599: Maintenance status for Video Embed Field now that media is in core.