User tests: Successful: Unsuccessful:
Situation before this change:
I have a couple of custom fields added to my article using the same technique as described here:
https://zunostudios.com/blog/development/203-how-to-add-custom-fields-to-articles-in-joomla
I then made a menu item of the type "tagged items" and tried to override the joomla default template for the tagged items list, which I found under components/com_tags/views/tag/tmpl/default_items.php
However the attribs are not available in $item (line 35 and ongoing)
Situation after this change:
The query which returns the items of the "tagged items" now also returns the attribs. And one can use something like this to use the attribs in the tagged items list:
$attrb = json_decode($item->attribs);
echo $attrb->foo;
I hope I didn't break anything - this is my first patch to the joomla project, so I'm happy to hear your feedback and improve my solution.
Have a nice weekend!
Kind regards,
nicolas
Labels |
Added:
?
|
Category | ⇒ | Libraries Tags |
Hi George :)
Thanks for your review and your feedback - I see the problem you mention and wonder how we can solve this the right way :)
Kind regards,
nicolas
So the 'most correct' way I can think of at the moment is to add a plugin event that allows us to manipulate the query. Then we manipulate the query add the join on the extra condition where ct.type_alias == 'com_content.article'
which makes it super generic (and stops us adding a dependency on com_content in the tags helper).
I'd add the plugin event directly after this line (or maybe the end of the helper method you were in - not 100%). What do you think?
@justinherrin There has been no PR to my knowledge that introduces the plugin trigger. To move this forward either @nikslor can update this PR to implement the trigger or a new PR has to be made that makes this change.
any Comment on this PR by Maintainers?
With 3.7 we have custom fields so this here might be not needed anymore, closing.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-24 09:46:14 |
Closed_By | ⇒ | rdeutz |
Category | Libraries com_tags | ⇒ | Libraries |
Hi,
So first of all can I just thank you for contributing to Joomla. We are super grateful :)
As to the pull request this method isn't correct because don't forget tags aren't just for the content component but also contact, weblinks, newsfeeds and other 3rd party components. This means that the join will fail when you have an article that isn't from com_content. I can see where you want to go with this tho. I'm on a train at the moment so let me sit down and look at the code when I'm back in front of a pc and I'll have a think. If I don't reply within 24 hours ping me again because it probably means I've forgotten (I'm awful like that!)
Thanks again for contributing this code though!
George