It doesn't look like there's a way align video on page when added from WYSIWYG editor

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tjgillies created an issue. See original summary.

Sam152’s picture

At 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?

Sam152’s picture

Status: Active » Postponed (maintainer needs more info)
tjgillies’s picture

I'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.

purushotam.rai’s picture

Component: User interface » Code
FileSize
4.08 KB

Just 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.

purushotam.rai’s picture

Patch for 8.x-3.x branch

vyasamit2007’s picture

Title: Alignment » Video Embed field attributes

I 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?

Sam152’s picture

Title: Video Embed field attributes » Add an alignment option to WYSIWYG videos.

Nope, 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.

ashleyhazle’s picture

I 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?

ashleyhazle’s picture

Turns out our editors were happy with using Paragraphs for layout, so we don't need this anymore. Definitely a better way to work :)

fabianfiorotto’s picture

Version: 8.x-1.0-rc8 » 8.x-2.0
FileSize
7.73 KB

I updated purushotam's code to apply in the current branch 8.x-2.x. I also added an implementation that uses wrappers.

Sam152’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

With 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.