Search
Other Articles Field questions
Forum

Jfilter with articleslinked field

Cyril Thibout's Avatar Cyril Thibout
Hi

As it is quite straightforward to create a Jfilter ( blue-coder.com/ ) based on the regular labs ARTICLES field I don't know how to make a search based on the "articleslinked" field.

We have two categories:

* movies

* actors

Each movie has an 'actors' regular labs ARTICLES field (pointing to or several actors)

Each actor has the reversed 'movies' regular labs ARTICLESLINKED field (pointing to the movies where the actor played)

we created a jflter menu item displaying the actors with a jfitler module with filters:

- the category (actors) which is in the listening mode to avoid displaying it

- the regular labs ARTICLESLINKED 'movies' filter

however the 'movies' filter doesn't show up.

I asked blue-coder support and we discovered that if we disable the ARTICLESLINKED plugin, the jfilter suddenly displays the filter (but of course with wrong results since the plugin is disabled)

That means that the filter returns something but it is then stripped by the "ARTICLESLINKED" field plugin. Blue coder wrote me to ask here to study the issue.

thanks


PS: we use Joomla 5.1 + ARTICLES FIELD 4.2.1 PRO
Peter van Westen's Avatar Peter van Westen ADMIN
That is something you would need to ask Jfilter support about.

The Articles Linked field doesn't store the article Ids that link to it in any way. It is just a yes/no (true/false) value.
The collecting of the linked articles is done inside the field output file itself.
Please post a rating at the Joomla! Extensions Directory
Cyril Thibout's Avatar Cyril Thibout
Thanks I will go back to jfilter but they sent me to you ...

anyway I would like to know how the collectig is done with the linkedarticles field.
is it done through the "Linked Fields" value in the general tab of the linked field?
thanks.

cyril
Peter van Westen's Avatar Peter van Westen ADMIN
Inside /plugins/fields/articles/layouts/plg_fields_articles/linked_articles.php the IDs of the linked articles are collected via a function, using the Articles Field(s) that connects to it and the current article ID.

Those Ids are then sent to a function that renders the layout output, which also collects the article info based on those IDs.

What you will probably need is something like this:
use RegularLabs\Plugin\Fields\Articles\Helper;

$article_id = ... // the current article id
$field = ... // the current Linked Articles field object

$ids = Helper::getLinkedArticleIds($custom_fields, $article_id, $field);
$articles = self::getArticlesByIds($ids);

// pass that to jFilters in whatever way they need it
Please post a rating at the Joomla! Extensions Directory
Cyril Thibout's Avatar Cyril Thibout
Ok thanks I will pass the info to Jfilters
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription