Updated 2026-04-30: removal target moved from 3.2.0 to 4.0.0 to comply with SemVer (removal of public API requires a major bump). Thanks to kmonty for the pushback.

Summary

The renderEmbedCode($width, $height, $autoplay, $title_format, $use_title_fallback) method should be deprecated in favor of renderEmbed(array $options).

The new renderEmbed() method provides a cleaner API that accepts an options array instead of positional parameters. The base implementation in ProviderPluginBase::renderEmbed() already delegates to renderEmbedCode() for backward compatibility, and all core providers (YouTube, Vimeo, YouTubePlaylist) already override renderEmbed() directly.

Steps

3.1.0

  1. Add @deprecated in video_embed_field:3.1.0 and is removed from video_embed_field:4.0.0. Use \Drupal\video_embed_field\ProviderPluginInterface::renderEmbed() instead. to:
    • ProviderPluginInterface::renderEmbedCode()
    • ProviderPluginBase::renderEmbedCode()
  2. Add a @trigger_error() call in ProviderPluginBase::renderEmbedCode() to emit a deprecation notice at runtime.
  3. Update any remaining callers in the module to use renderEmbed() instead.

4.0.0

  1. Remove renderEmbedCode() from ProviderPluginInterface.
  2. Remove renderEmbedCode() from ProviderPluginBase.
  3. Remove renderEmbedCode() overrides from provider plugins (YouTube, Vimeo, YouTubePlaylist).
  4. Remove the delegation in ProviderPluginBase::renderEmbed() that calls renderEmbedCode().

Motivation

The options array pattern is more flexible and easier to extend without breaking the method signature. Third-party provider plugins (e.g. video_embed_dailymotion) need to support both methods during the transition period.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review
mably’s picture

Issue summary: View changes

  • mably committed dd5f300b on 3.x
    task: #3580405 Deprecate renderEmbedCode() in 3.1.0, remove in 3.2.0
    
    By...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kmonty’s picture

Might I suggest removing this in the next major, (e.g. 4.0.0) rather than the next minor release? According to semver, removals should be done in majors. This prevents someone who does a composer update with unpinned dependencies from having their application potentially break.

See https://github.com/semver/semver/issues/712#issuecomment-913201179

mably’s picture

I have no problem with that. Could you provide an MR please?

We will probably release a 4.0.0 version for Drupal 12.

mably’s picture

Title: Deprecate renderEmbedCode() in 3.1.0, remove in 3.2.0 » Deprecate renderEmbedCode() in 3.1.0, remove in 4.0.0
Issue summary: View changes
Status: Closed (fixed) » Active

mably’s picture

I have updated the issue: removal target moved from 3.2.0 to 4.0.0. The @deprecated + @trigger_error() already on the 3.x branch can stay; only the timeline shifts. A new MR has been created to amend the deprecation strings to point to the new target.

mably’s picture

Status: Active » Needs review