Bug #87033

config.htmlTag_setParams overrides all existing attributes

Added by Benni Mack over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Frontend
Target version:
Start date:
2018-11-29
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The new Site handling functionality should ideally avoid
TypoScript conditions as much as possible. However,
if someone wanted to add attributes via config.htmlTag_setParams
all language-dependant properties (e.g. dir and lang) which
are generated by the site configuration are gone, leading to the
way of having to workaround this issue by using stdWrap or conditions).

So, in order to add a "amp=true" attribute to your HTML tag, you need to add
conditions if you want to keep the "dir" (language-dependant) attribute as well.


Related issues

Related to TYPO3 Core - Task #86854: Allow adding custom attributes on HTML-Tag Closed 2018-11-05

Associated revisions

Revision 8a811b6e (diff)
Added by Benni Mack over 1 year ago

[FEATURE] Allow to override htmlTag attributes

The new Site handling functionality should ideally avoid
TypoScript conditions as much as possible. However,
if someone wanted to add attributes via config.htmlTag_setParams
all language-dependant properties (e.g. dir and lang) which
are generated by the site configuration are gone, leading to the
way of having to workaround this issue by using stdWrap or conditions)

In order to re-implement this functionality but also build on a
more flexible level, a new TypoScript property
"config.htmlTag.attributes." is added, which is an array
for setting attributes to the <html> tag dynamically.

This superseds the previous config.htmlTag_setParams option
by providing a more flexible API to add attributes.

`config.htmlTag.attributes.class = no-js`

It is even possible to add attributes without a value:
`config.htmlTag.attributes.amp = `

would render `<html lang="en" amp>` - keeping the existing
parameters that are set by other TypoScript anyways.

Resolves: #87033
Releases: master
Change-Id: I6a18671fffbf97aab8d3dda938dc261706e4e6fd
Reviewed-on: https://review.typo3.org/58976
Reviewed-by: Josef Glatz <>
Tested-by: TYPO3com <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>
Reviewed-by: Benjamin Kott <>
Tested-by: Benjamin Kott <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58976

#2 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58976

#3 Updated by Benni Mack over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#4 Updated by Riccardo De Contardi over 1 year ago

  • Related to Task #86854: Allow adding custom attributes on HTML-Tag added

#5 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF