Try: Provider-specific embed block settings (Tweet theme option) #3032
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related: #2744
This pull request seeks to explore adding provider-specific embed block settings. Many oEmbed providers support additional URL parameters which are not part of the embedded URL itself, but can be passed as part of the oEmbed fetch request. It is not currently possible to pass additional arguments through as part of this fetch request except through filters. The changes here seek to introduce support for an
args
shortcode argument on the underlying[embed]
shortcode, and complementary block controls to control their setting. This is currently implemented in an isolated case, exposing the Twitter embed "Dark theme" display:Tweet oEmbed parameter reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed#parameters
Implementation notes:
The implementation warrants a second look and is incomplete:
theme
and assigning 'dark' explicitly.theme
attribute is assigned, since the server-defined attributes are not recursively merged. A better long-term solution here is consolidating attributes definition to the server (Block API: Server-side awareness of block types #2751).getEmbedBlockSettings
function into a more extendable / composable format.'enum'
type for block attributes, which is already supported in the REST API (whose functions are used for server-side attribute validation) and could simplify the definition of a predefined set of values ('light'
,'dark'
)Testing instructions: