-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add string version of tag entity #9
base: master
Are you sure you want to change the base?
Conversation
I think a helper would be the best way to handle the output of the tags. I don't like using the Table object everywhere. A helper would allow us to encapsulate all presentation logic properly an offer more than just a comma separated string. Here are a few examples: echo $this->Tag->cloud($muffin->tags);
echo $this->Tag->string($muffin->tags, ['separator' => ',']);
echo $this->Tag->input($muffin->tags);
echo $this->Tag->select($muffin->tags); The helper could use a template string just like the HTML helper for the cloud and tag string as well. |
A helper on top of that is totally fine and actually the right way to go I believe. |
What do you think about this? https://gist.github.com/burzum/4031a5b39071714af002 |
@ADmad Jad just told me to do this on Skype:
😄 |
bump |
@ADmad your feedback please? See the 2nd last comment up from this one. |
Am here, am here... just haven't been having the greatest of times, though things are starting to be much better. I don't have time to add tests myself ATM, so anyone's help would be very much appreciated 😄 |
@ADmad no time for it right now. I'm renovating three rooms and have a ton of work after my vacation. |
I can write tests tomorrow. |
Maybe the aliens just gave him back a day so it appeared they didnt take him, though they now might have after all for good. |
I implemented this in the new tags repo @ https://github.com/dereuromark/cakephp-tags |
I like this approach, let me know what you guys think.
This lets you do:
So in a form, this should do:
It isn't the prettiest yet but at this point we can either add
TagAwareTrait::_getTags()
which would automatically return theimplode()
d result or let it up to the users to use that in case they want strings or leave as is for multi-select.To add the ID for their implementation, either do that when instantiating the table the first time:
Or extend the
TagsTable
and define a custom$_toStringTemplate
.