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

Remove imagemargin and floating in Contao 5 #4575

Closed
bezin opened this issue Apr 29, 2022 · 12 comments · Fixed by #4788
Closed

Remove imagemargin and floating in Contao 5 #4575

bezin opened this issue Apr 29, 2022 · 12 comments · Fixed by #4788
Assignees
Labels
Milestone

Comments

@bezin
Copy link
Contributor

bezin commented Apr 29, 2022

Description

Many years ago we had margin before and margin after fields for content elements (not exactly sure about that), which we removed because that was theme-related. I think we should finally remove imagemargin and floating, too, as this is theme-related as well and should be solved otherwise.

The same goes for the layout options (rows and columns) in the gallery element actually, but this might be another topic.

@bezin bezin added the feature label Apr 29, 2022
@fritzmg
Copy link
Contributor

fritzmg commented Apr 29, 2022

Why do you want to remove floating? We use that all the time. Same with images per row for gallery elements.

@bezin
Copy link
Contributor Author

bezin commented Apr 30, 2022

Why do you want to remove floating? We use that all the time. Same with images per row for gallery elements.

We don't use either. But I can see, how you might use these — at least floating.

Let us see, how others use these settings.

@leofeyer leofeyer added this to the 5.0 milestone Apr 30, 2022
@leofeyer
Copy link
Member

I agree that we should probably keep the floating setting.

@fritzmg
Copy link
Contributor

fritzmg commented May 1, 2022

And regarding the row setting for gallery elements - that's how we use it:

.ce_gallery {
    ul {
        display: grid;
        gap: var(--grid-gap);
    }

    @for $i from 1 through 12 {
        ul.cols_#{$i} {
            grid-template-columns: repeat(#{$i}, 1fr);
        }
    }
}

plus a mechanism to automatically set the appropriate image size from contao.image.sizes.

@m-vo
Copy link
Member

m-vo commented May 1, 2022

I agree that we should probably keep the floating setting.

Yes, in the new elements I would name it layout though, and make it a property of the content element instead of the figure/image.

@contaoacademy
Copy link

Yes, please keep the floating setting.

@bennyborn
Copy link
Contributor

I'm also for keeping the floating but I'd also really like to see the imagemargin gone 😁

@Toflar Toflar added the up for discussion Issues and PRs which will be discussed in our monthly Mumble calls. label May 11, 2022
@Toflar
Copy link
Member

Toflar commented May 11, 2022

Marking up for discussion because that's actually an easy one for anybody to contribute, we just need to decide what :)

@m-vo
Copy link
Member

m-vo commented May 11, 2022

Here is what I'm currently doing in #4444:

$layoutAttributes = new HtmlAttributes();
if ($model->addImage && $position = $model->floating) {
$layoutAttributes->addClass("image--$position");
}
$template->set('layout_attributes', $layoutAttributes);

{% extends "@Contao/content_element/_base.html.twig" %}
{% block content %}
<div{{ layout_attributes }}>
{% block content_inner %}
{# RTE text #}
{% block text %}
<div class="rte">{{ text|insert_tag|raw }}</div>
{% endblock %}
{# Image #}
{% block image %}
{% if image %}
{% include "@Contao/component/_figure.html.twig" with {
figure: image,
figure_attributes: attrs(figure_attributes|default).addClass('image_container')
} %}
{% endif %}
{% endblock %}
{% endblock %}
</div>
{% endblock %}

@fritzmg
Copy link
Contributor

fritzmg commented May 11, 2022

Here is what I'm currently doing in #4444:

That would introduce additional wrappers which I wouldn't like 🙃. I'd prefer the class being added on the main wrapper.

@m-vo
Copy link
Member

m-vo commented May 11, 2022

Well, that's debatable. 🙂 IMHO it's better this way as it semantically separates outer and inner layout.

But, having a separate set of attributes makes it easy to adjust:

{% extends "@Contao/content_element/text.html.twig" %} 

{% set attributes = attributes.mergeWith(layout_attributes) %}

{% block content %}
  {{ block('content_inner') }}
{% endblock %}

@leofeyer
Copy link
Member

leofeyer commented Jun 2, 2022

As discussed in the Contao call, we want to keep the floating field and only remove the imagemargin field.

@leofeyer leofeyer removed the up for discussion Issues and PRs which will be discussed in our monthly Mumble calls. label Jun 2, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants