Using helper getTagItemsQuery needs alias ids not actual aliases

209 views Asked by At

I am writing a module to display tags and I'm using the JHelper method getTagItemsQuery.

In the documentation it states that the second parameter should be a content alias (eg. 'com_content.article' ) but from what I can see in the code, it assumes that the second parameter is a content type id. So for example, this returns a valid query

$query = $tags->getTagItemsQuery( 2 , 1, true, 'c.core_publish_up', 'DESC', true, 'all', '1' );

But this does not:

$query = $tags->getTagItemsQuery( 2 , 'com_content.article', true, 'c.core_publish_up', 'DESC', true, 'all', '1' );

(the resulting query has an empty IN statement)

On line 596 of the code it seems to explicity assume that the second parameter ($typesr) is an id, not an alias

$typesarray = self::getTypes('assocList', $typesr, false);

Is this an error in the documentation for getTagItemsQuery, or have I misunderstood how it should be used?

1

There are 1 answers

0
user1104799 On BEST ANSWER

Hah! I only just posted this when I came across the following issue posted on github

https://github.com/joomla/joomla-cms/issues/4655

So the answer is that this it is an error in the documentation and has been flagged as such in Joomla github (though it doesn't seem to have worked it's way through to the doctype comments)