? Success

User tests: Successful: Unsuccessful:

avatar nikslor
nikslor
22 Mar 2015

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

avatar nikslor nikslor - open - 22 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 22 Mar 2015
Category Libraries Tags
avatar wilsonge
wilsonge - comment - 22 Mar 2015

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

avatar nikslor
nikslor - comment - 22 Mar 2015

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

avatar wilsonge
wilsonge - comment - 23 Mar 2015

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?

avatar justinherrin
justinherrin - comment - 17 Jan 2016

Is there anything we can do to push this idea forward @wilsonge or perhaps this was accomplished in a more recent PR that I missed in my search tonight?

I'm trying to pull in attribs of a content article into a tagged items menu view...

avatar roland-d
roland-d - comment - 21 May 2016

@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.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6541.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 11 Mar 2017

any Comment on this PR by Maintainers?

avatar rdeutz
rdeutz - comment - 24 May 2017

With 3.7 we have custom fields so this here might be not needed anymore, closing.

avatar rdeutz rdeutz - change - 24 May 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-05-24 09:46:14
Closed_By rdeutz
avatar rdeutz rdeutz - close - 24 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 24 May 2017
Category Libraries com_tags Libraries

Add a Comment

Login with GitHub to post a comment