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.
Problem/Motivation
See #2567743-16: Add protocol filtering to Attribute, which use modifies <drupal-render-placeholder callback=… arguments=… token=…>
to <drupal-render-placeholder data-callback=… arguments=… token=…>
.
The problem with that can be found in the accompanying comment:
// Generate placeholder markup. Note that the only requirement is that this
// is unique markup that isn't easily guessable. The #lazy_builder callback
// and its arguments are put in the placeholder markup solely to simplify
// debugging.
Prefixing it with data-
makes it less developer-friendly.
Proposed resolution
This could (and IMO should) just not use Attribute
, and do a SafeString::create()
. This is internal in the Renderer
anyway.
Remaining tasks
Review.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2569371-2.patch | 1.91 KB | Wim Leers |
Comments
Comment #2
Wim LeersComment #3
catchYep, that's a better change, no need to run that through Attributes the whole point is this is hardcoded.
Comment #4
alexpottNice - and it'll make it easier to convert SafeMarkup::format() to return an object like t() too.
Committed 4a7ffc9 and pushed to 8.0.x. Thanks!
Comment #6
dawehnerCan we trust those arguments?
Comment #8
BerdirLooks like the new generated placeholders break when parsed as XML: #2593481: PlaceholderGenerator::createPlaceholder() generates invalid markup; causes placeholders to not be replaced if processed by DOMDocument