Problem/Motivation

ThemePreprocess, HtmxRenderer, and OEmbedIframeController each build HTML attachment placeholders on their own. All three use the same tag names for the attachment types they need. Two methods in BigPipe do the same work with custom tag names.

All five places also use Crypt::randomBytesBase64(55) to generate the placeholder token. They shouldn't have to deal with how to encode them.

Proposed resolution

Centralize building the placeholder markup in HtmlResponseAttachmentsProcessor::createPlaceholders(). BigPipe may override the standard tag names.

As an optional second step, centralize token generation in HtmlResponseAttachmentsProcessor::createPlaceholderToken().

Cover standard tags, a tag override, and an override without matching type in a unit test.

Remaining tasks

Review.

User interface changes

None.

Introduced terminology

None.

API changes

Added createPlaceholders() and createPlaceholderToken() to the existing HtmlResponseAttachmentsProcessor class.

Data model changes

None.

Release notes snippet

n/a

Issue fork drupal-3642122

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

pancho created an issue. See original summary.

pancho’s picture

Status: Active » Needs review