Problem/Motivation
As part of #2296101: Remove SafeMarkup::set() use in \Drupal\Core\Render\Element\HtmlTag::preRenderHtmlTag(), we identified the potential improvement of removing #type => 'html_tag' (including dawehner in #4 and catch in #7.
From #38:
[T]he non-test uses [of
#type => 'html_tag'] in core can be grouped into 2 categories:<head>elements such as<meta>,<link>, and<script>, and simple combinations where SafeMarkup::format could be used instead._drupal_add_html_head() is listed as deprecated (#2477223: Refactor _drupal_add_html_head, drupal_get_html_head, _drupal_add_html_head_link into the attachments processor, remove from common.inc.), so we may need to postpone on that. In the meantime, we could work on the 6 places where non-head-type tags are using this #type? (One of those places is FilterCaption.php, which has its own use of SafeMarkup).
Proposed resolution
remove the 6 places where non-head-type tags are using #type => 'html_tag'
and
Remove \Drupal\Core\Render\Element\HtmlTag
Remaining tasks
User interface changes
?
API changes
Data model changes
| Comment | File | Size | Author |
|---|
Comments
Comment #1
akalata commentedComment #2
harjotsingh commentedAccording to https://www.drupal.org/node/2280965 i removed the SafeMarkup::set() from FilterCaption.php
Comment #3
harjotsingh commentedComment #5
star-szrComment #6
yesct commented@harjotsingh This issue is not to remove the set().
This issue is to remove
"6 places where non-head-type tags are using this #type => 'html_tag'"
Comment #7
harjotsingh commentedShouldn't we remove SafeMarkup::set() call according to https://www.drupal.org/node/2280965.
Comment #8
joelpittet@harjotsingh Yes but the issue title and issue summary are not related to FilterCaption. If that issue is not already open please open it and add it to the meta. It looks like on the meta that issue hasn't been created yet. Can you create that for us? The meta issue summary has some instructions on how to do that.
Comment #9
harjotsingh commented@joelpittet
yes, i'll open the issue and add it to meta.
Thanks for the clarification.
Comment #10
joelpittetThis is likely not going to happen in the 8.x life cycle since we are in RC for 8.0.0 and still use this in core.
Comment #11
star-szrComment #12
catchBefore we can remove the element type, we need to remove the usages and deprecate it. So moving this back to 8.x for that.
Comment #13
joelpittetRemoving all of them can take some time, so let's do it one bit at a time. Moving this to a plan to hang some children off of.
Comment #15
samuel.mortensonThis issue was referenced in #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs, as I proposed that html_tag could feasibly be used to render SVG elements using structured render arrays. I'm not sure if deprecating html_tag is still on the table, but I still rely on this element in my custom code and contrib modules I use rely on this render element as well:
http://cgit.drupalcode.org/acquia_lift/tree/acquia_lift.module#n72
http://cgit.drupalcode.org/address/tree/src/Plugin/Field/FieldFormatter/...
http://cgit.drupalcode.org/commerce/tree/modules/order/src/Form/OrderFor...
http://cgit.drupalcode.org/config_sync/tree/src/Form/ConfigSyncInitializ...
http://cgit.drupalcode.org/entity_browser/tree/src/Element/EntityBrowser...
http://cgit.drupalcode.org/entity_gallery/tree/entity_gallery.module#n1254
http://cgit.drupalcode.org/features/tree/modules/features_ui/src/Form/Fe...
http://cgit.drupalcode.org/geolocation/tree/modules/geolocation_google_p...
http://cgit.drupalcode.org/media_entity/tree/src/MediaBundleForm.php#n185
http://cgit.drupalcode.org/responsive_preview/tree/responsive_preview.mo...
After briefly auditing how these modules use html_tag, I agree that they could use Markup instead, although in #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs we're discussing allowing html_tag elements to have child render arrays, which would be a useful feature that Markup could not provide.