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

Do not add empty CSS classes to the template #2115

Merged
merged 2 commits into from
Aug 7, 2020

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Aug 6, 2020

Q A
Fixed issues -
Docs PR or issue -

Currently $classes will always be an array, passed down from ModuleArticle::compile. The array could contain first or last for example, but otherwise will be empty. In that case an empty string is added to the class template variable, resulting in HTML markup like this:

<div class="ce_example_element "></div>

This PR adds a check for whether the $classes array is empty, to prevent the superfluous space.

@fritzmg fritzmg added the bug label Aug 6, 2020
@fritzmg fritzmg added this to the 4.9 milestone Aug 6, 2020
@fritzmg fritzmg self-assigned this Aug 6, 2020
Copy link
Member

@leofeyer leofeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to keep the is_array() check.

@leofeyer leofeyer merged commit 6e1ab43 into contao:4.9 Aug 7, 2020
@leofeyer
Copy link
Member

leofeyer commented Aug 7, 2020

Thank you @fritzmg.

@leofeyer leofeyer changed the title Do not add empty CSS classes to template Do not add empty CSS classes to the template Aug 10, 2020
@fritzmg fritzmg deleted the add-css-attributes-to-template-fix branch October 24, 2021 21:53
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

2 participants