Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Add extra data attributes for collections #5145

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@

{% block collection_widget %}
{% spaceless %}
{% set attr = attr|merge({'data-collection': true}) %}

{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': form_row(prototype) }) %}
{% set attr = attr|merge({'data-collection-prototype': form_row(prototype)}) %}
Copy link
Member

Choose a reason for hiding this comment

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

This is a BC break as it changes the attribute name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, you're right. I didn't think it was because it's only in the template. What is the correct course of action from here?

Copy link
Member

Choose a reason for hiding this comment

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

it is not only in the template. It is also used by the JS code implemented by users with the existing attribute name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any way to get a PR like this merged if it breaks backwards compatibility? IMO the break is pretty small. I could resubmit with the additions only but then the attributes would be inconsistent.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I think using data-prototype as name would be better as it would keep the BC.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that data-collection-prototype would be a better name here, but I don't want to break BC. Can you please revert this and add a TODO-3.0.md file in the symfony root directory where you note that this attribute should be renamed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bschussek Just to be 100% clear.

  • Keep the new attributes: data-collection, data-collection-add & data-collection-delete
  • Revert data-collection-prototype to data-prototype
  • Add data-collection -> data-collection-prototype to TODO-3.0.md

👍

Copy link
Member

Choose a reason for hiding this comment

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

I'm against adding a TODO-3.0.md in the repository. Instead, create an issue on Github.

Copy link
Contributor

Choose a reason for hiding this comment

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

@leevigraham exactly

{% endif %}

{% if allow_delete is defined %}
{% set attr = attr|merge({'data-collection-delete': allow_delete}) %}
{% endif %}

{% if allow_add is defined %}
{% set attr = attr|merge({'data-collection-add': allow_add}) %}
{% endif %}
{{ block('form_widget') }}
{% endspaceless %}
Expand Down