Skip to content

Conversation

@Coffee2CodeNL
Copy link

Fixing label issue (#28)

Fixing label issue
@ninsuo
Copy link
Owner

ninsuo commented Aug 1, 2017

Hello

Thank you for your contribution.

Quickly read the problem, and wondering if you checked this page?

https://symfony-collection.fuz.org/symfony3/troubleshoot/hide-form-labels

@Coffee2CodeNL
Copy link
Author

Yeah, but that's just hiding the label.

With my addition, it's now possible to actually use that label and show numbered "steps" or "items" if you will.

@ninsuo
Copy link
Owner

ninsuo commented Aug 1, 2017

Nice.
Will check this closer within a couple of hours.

@Coffee2CodeNL
Copy link
Author

Okay, so when adding fields, it works.

But when loading in such a collection it gets rendered by twig, currently i'm solving it with adding

{%- if name matches '/^\\d+$/' -%}
        {%- set name = 'item ' ~ (name|number_format + 1) -%}
{%- endif -%}

But users need to add this to their templates if they want labels to be displayed properly.

@ninsuo
Copy link
Owner

ninsuo commented Aug 1, 2017

And I think moving elements won't sort correctly those numbers.
We may think of a better solution, like a selector to write position nbr somewhere.

@Coffee2CodeNL
Copy link
Author

Position is being stored in a hidden field, though.

@ninsuo
Copy link
Owner

ninsuo commented Aug 1, 2017

Sure, but it may be more friendly to set a selector like span.position so you could use <label>Item #<span class="position"></span></label> to automatically fill Item #42 on your view without tricky hacks.

@Coffee2CodeNL
Copy link
Author

Yeah, but keep in mind it wouldn't always be "Item" either ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants