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

Fix checkbox label margin (remove empty label) #442

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/forms/default/field.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
{% set layout_form_field_outer_classes = layout_form_field_outer_classes|trim ~ ' ' ~ embed_outer_field_classes %}

{# Show Label logic #}
{% set show_label = field.label is not same as(false) and field.display_label is not same as(false )%}
{% set show_label = field.label is not same as(false) and field.display_label is not same as(false) and show_label is not same as(false) %}

{# Label Classes #}
{% set layout_form_field_outer_label_classes = ((form_field_outer_label_classes ?: 'form-label') ~ ' ' ~ field.labelclasses)|trim %}
Expand Down
4 changes: 1 addition & 3 deletions templates/forms/fields/checkbox/checkbox.html.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% set show_label = false %}
{% extends "forms/field.html.twig" %}

{% block label %}
{% endblock %}

Copy link
Member

Choose a reason for hiding this comment

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

I would approve this if you didn't remove the label block. It does no harm if not used, and might be being used by users with an extend

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhukster I am not sure if that would make sense. Since we are disabling the whole block, it cannot be displayed anyways. So even when extending the block (for whatever reason) it wont be displayed. Correct me, if I am wrong.

https://github.com/getgrav/grav-plugin-form/blob/develop/templates/forms/layouts/field.html.twig#L4-L20

Copy link
Member

Choose a reason for hiding this comment

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

I need more time to review this, but need to get a release out.. so will leave this one here until I can check it with the other label related PR

{% block input %}
{% set id = field.id|default(field.name)|hyphenize %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
Expand Down