- Issue created by @dieterholvoet
- 🇧🇪Belgium dieterholvoet Brussels
It would be even better if we didn't have this only if the field allows multiple bundles, and if we could choose the field whose value is displayed at that position. Example: a field allows referencing events. Events have an entity reference field referencing a taxonomy vocabulary 'event type' (e.g. Club night, Concert). It would be useful to show that value next to the entity label. Let me know what you think.
- 🇧🇪Belgium dieterholvoet Brussels
I updated the issue title/description. @gxleano can you let me know if you think this kind of feature would be useful? Just so I know if it's worth it for me to spend time developing this.
- 🇪🇸Spain gxleano Cáceres
Hi @DieterHolvoet!
Thanks for always giving feedback and suggesting new ideas for the module.
In this case, if we add the ability to show extra information (bundle type for instances) on the tag, it might make the tag too full and not very user-friendly. I'm not sure if that's the best user experience.
Another option could be to show the bundle type when you hover over the tag. This way, we wouldn't add more stuff to the tag, and users could see the bundle type when they hover. I found a nice example here: https://atomiks.github.io/tippyjs/#placements. We could try to implement something similar without needing an external source.
- Status changed to Closed: won't fix
about 1 year ago 6:04pm 13 February 2024 - 🇪🇸Spain gxleano Cáceres
Closing this issue because it has been inactive for almost a month.
If this topic returns, a new issue will be created.
- Status changed to Active
about 1 year ago 3:12pm 19 March 2024 - 🇧🇪Belgium dieterholvoet Brussels
I'm not sure if a hover tooltip would be a good alternative since the information wouldn't be immediately visible, and if you're using a touch device the information wouldn't be visible at all. I don't think the tag being too full would be a big concern. What exact information would be displayed would be configurable, so it's the user's choice how much they want to put in there.
I really believe this would be a good improvement, I could use it on multiple entity reference fields in a project I'm working on almost daily. Entity labels are not unique identifiers, for me it happens regularly that multiple entities have the same title and if that happens, it becomes really hard to pick the right entity from the list. Adding contextual information would help a lot.
- 🇪🇸Spain gxleano Cáceres
@DieterHolvoet
Let's try it and see how it is looking.
- Assigned to sourabhsisodia_
- Merge request !74Created feature to show extra metadata in results. → (Merged) created by sourabhsisodia_
- last update
about 1 year ago 2 pass - Issue was unassigned.
- Status changed to Needs review
about 1 year ago 11:11am 21 March 2024 - 🇪🇸Spain gxleano Cáceres
@sourabhsisodia_
Thanks to start working on this.
I've added some comments to the MR, I will take over of this.
Moving the issue to Needs work.
- Assigned to gxleano
- Status changed to Needs work
about 1 year ago 5:51pm 21 March 2024 - 🇪🇸Spain gxleano Cáceres
https://www.drupal.org/project/tagify/issues/3412898#comment-15507817 ✨ Add the ability to show extra metadata in results Needs work
1. Metadata appears as undefined when the entity reference is a Taxonomy term.
2. Metadata label doesn't appear when 'Include entity Id' option is not checked. - last update
about 1 year ago 2 pass - Issue was unassigned.
- Status changed to Needs review
about 1 year ago 11:53am 22 March 2024 - 🇧🇪Belgium dieterholvoet Brussels
Would be nice if we could configure what exact info is shown in the label, as described in the issue description. The best way seems to me to use a text field where you can use tokens to include certain field data. Should be fairly easy to implement, I can have a look at this if you want.
- 🇪🇸Spain gxleano Cáceres
Sure @DieterHolvoet
Feel free to take over of this, as you already have clear the idea.
Hey @gxleano, your remarks and code changes looks great, learned a lot.
- 🇧🇪Belgium dieterholvoet Brussels
About naming: we probably shouldn't call this 'entity label', since in Drupal context that usually means the title of the label. We also shouldn't use 'tag', since that's the whole feature of this module. What about 'info label'? Or any other ideas?
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - Status changed to Needs work
about 1 year ago 9:10pm 22 March 2024 - 🇧🇪Belgium dieterholvoet Brussels
I renamed the 'entity label' terminology to 'info label' and I made the content of the tag dynamic. I started work on the user widget as well, but both still need some finishing touches and testing. Some use cases I already tried it out with:
Referencing events and showing the dates
Referencing music releases and showing the artists
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - Status changed to Needs review
about 1 year ago 12:15pm 23 March 2024 - 🇧🇪Belgium dieterholvoet Brussels
In the user widget, I made the info label the line that was previously hardcoded to the user email address. Now people can choose what to show there. There's an update hook that makes sure the email will stay displayed for existing websites.
I think everything is ready now, let's start testing!
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - 🇧🇪Belgium dieterholvoet Brussels
@gxleano I had to revert the changes you did in your commit 'Avoid to remove duplicated labels from different bundle', where you changed the tagify tag value from the label to the entity ID. It broke the functionality of automatically creating new entities inline: when pasting a word in the input field or typing an unknown title and pressing enter, the tag would show 'undefined'.
- 🇪🇸Spain gxleano Cáceres
@DieterHolvoet
I'll work on this https://www.drupal.org/project/tagify/issues/3412898#comment-15513703 ✨ Add the ability to show extra metadata in results Needs work , because we need to have this modification/fix.
If we don't have it, we won't be able to add a tag with same value/name and different vocabulary, for instance:
Term 1 (Fruit)
Term 1 (Vegetable)Tagify will detected as duplicated. So, the value would need to be the entity id (to be unique).
- 🇪🇸Spain gxleano Cáceres
On the other hand, regarding the use of tokens, I like the idea (don't get me wrong), but I would try to do this without depending on external modules.
My idea would be to create a select element instead of a textfield, where list all the available fields/values on the entity which we are going to use the Tagify widget, then the user could select which value want to show in the info label.
I will finish to check your code and do the rest of the modification.
Thanks and good job @DieterHolvoet 💪🏼
- Assigned to gxleano
- Status changed to Needs work
about 1 year ago 10:24am 25 March 2024 - 🇧🇪Belgium dieterholvoet Brussels
If we don't have it, we won't be able to add a tag with same value/name and different vocabulary.
That's not a new issue though, right? That problem is not being introduced by this new feature? In that case I would create a new issue for that and discuss it further over there, just to keep this focused.
On the other hand, regarding the use of tokens, I like the idea (don't get me wrong), but I would try to do this without depending on external modules.
Tokens are part of Drupal core. There is a contrib module named Token, which provides extra tokens that Drupal core doesn't, but the whole token concept is a Drupal core thing. You're right about the UI part, the
token_tree_link
theme hook, being part of the contrib module. We could place a check around it to only render it when the module is installed, since it's completely optional. The Token module is the top installed, most popular Drupal module though, so it's probably installed on most sites. I do agree that we shouldn't add it as a dependency. - 🇧🇪Belgium dieterholvoet Brussels
My idea would be to create a select element instead of a textfield, where list all the available fields/values on the entity which we are going to use the Tagify widget, then the user could select which value want to show in the info label.
I really wouldn't do this. It would be kind of reinventing the wheel: it would introduce a lot of extra logic and we would lose a lot of flexibility that the token system provides. Tokens are the de facto way to do this kind of thing across Drupal core and contrib.
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - 🇪🇸Spain gxleano Cáceres
@DieterHolvoet
https://www.drupal.org/project/tagify/issues/3412898#comment-15513703 ✨ Add the ability to show extra metadata in results Needs work
Is already handled here https://www.drupal.org/project/tagify/issues/3435956 🐛 Tags with same value are considered duplicated Needs review
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - 🇪🇸Spain gxleano Cáceres
Added support for images to Info Label.
Example:
Country vocabulary with image field 'Flag'.
Using the token:
[term:field_flag:thumbnail:url]
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - 🇧🇪Belgium dieterholvoet Brussels
After the latest updates the info tags seem to be missing right padding:
When I inline edit the title of an already referenced entity, after pressing enter the change is discarded.
I also feel like the left/right padding around the images is a little too much. How about 0.5rem on both sides, like this?
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - 🇪🇸Spain gxleano Cáceres
Thanks to catch up @DieterHolvoet
The fixes are already in place.
- 🇧🇪Belgium dieterholvoet Brussels
The padding issues are fixed, thanks!
When I inline edit the title of an already referenced entity, after pressing enter the change is discarded.
Now the changes aren't discarded anymore after pressing enter, but they also aren't saved after submitting the form. Did it work like this before? Are you supposed to be able to change the titles of referenced entities in the Tagify widget? If so, this should be fixed.
- 🇧🇪Belgium dieterholvoet Brussels
I had another idea: maybe we could improve the
tagify_autocomplete_matches
alter hook. Currently, it's not that useful since the entity object is not passed. Only the label strings are passed, but they generally don't contain enough information to make decisions.How about we add a
tagify_autocomplete_match
alter hook? We call it after$this->token->replacePlain()
and we pass the$entity
,$label
(as reference, so we can change it) and$info_label
(also as reference, so we can change it). If a hook implementation returns FALSE, the match is not included in the results.I can implement this if you want, just let me know if you think it's a good idea.
- 🇪🇸Spain gxleano Cáceres
Now the changes aren't discarded anymore after pressing enter, but they also aren't saved after submitting the form. Did it work like this before? Are you supposed to be able to change the titles of referenced entities in the Tagify widget? If so, this should be fixed.
It seems there might be a misunderstanding about how tag editing works. When you edit a tag, it doesn't automatically update the referenced content associated with that tag. Instead, the tag itself is modified. For example, if you change a tag from 'Orange' to Apple, it simply updates the tag label. If 'Apple' already exists, it switches to that tag; otherwise, it creates a new tag (if auto-creation is enabled). This functionality has always worked in this way.
- 🇧🇪Belgium dieterholvoet Brussels
Okay, good to know! Thanks for the explanation.
- 🇪🇸Spain gxleano Cáceres
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 6:29pm 1 April 2024 - Status changed to Fixed
about 1 year ago 11:09am 2 April 2024 - last update
about 1 year ago 2 pass - 🇧🇪Belgium dieterholvoet Brussels
Thanks for your work! I'll create a separate issue for the alter hook.
- Status changed to Fixed
about 1 year ago 4:43pm 2 April 2024