Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate inheriting CSS classes in nested elements #6975

Merged
merged 4 commits into from Mar 7, 2024

Conversation

aschempp
Copy link
Member

@aschempp aschempp commented Mar 7, 2024

The ContentElementReference has a special attribute classes, which is then forwarded to the content element. The same should apply when rendering a regular content element from a reference (e.g. for nested elements).

The class is added to the template by all legacy elements: https://github.com/contao/contao/blob/5.x/core-bundle/contao/elements/ContentElement.php#L260

@m-vo
Copy link
Member

m-vo commented Mar 7, 2024

Out of interest: where is this needed/in use?

@aschempp
Copy link
Member Author

aschempp commented Mar 7, 2024

I have an element with nested fragments, and some of those fragments are legacy classes. If I remember correctly, the core uses the classes property to forward content element classes to a module fragment. In my case, I'm manually adding classes to the fragment reference (also see madeyourday/contao-rocksolid-custom-elements#169).

@leofeyer leofeyer changed the title Fixed inheriting CSS classes in nested elements Deprecate inheriting CSS classes in nested elements Mar 7, 2024
@leofeyer leofeyer merged commit 7db3447 into contao:5.3 Mar 7, 2024
17 checks passed
@leofeyer
Copy link
Member

leofeyer commented Mar 7, 2024

Thank you @aschempp.

@aschempp aschempp deleted the fix/nested-classes branch March 7, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants