I would like to use Archivist and getArchives, which both should take the new (thanks to Bruno for linguaPdoTools!) language specific setup into account.
How can I teach Archivist to generate a menu based on the available resources for the selected language?
Right now my Archivist generated menu looks like this:
2015 (5) | 2014 (15) | 2013 (17) | 2012 (10)
The numbers in brackets are counting the resources for that year, via the Archivist-placeholder [[+count]]
Right now these Numbers don't change. Advice from Bruno: Use the &where filter and pass the IDs of the current language to it. Get the IDs via pdoResources or write a small custom Snippet.
I have no clue which field to run that filter on? &where=`{"how-do-i-get-this-field?":"id-of-language"}`
According to the doc's this is how one could get the ID of the current language: [[!lingua.getField? &field=`id`]]
--------------------
How to use getArchives (thanks to Bruno for the advice)
getArchives calls getResources internally. So you would want to add the parameter &grSnippet with a value of pdoResources, as well as the other parameters. A complete getArchives call could then look like this:
[[!getArchives?
&parents=`123`
&tpl=`YourTemplateName`
&grSnippet=`pdoResources`
&includeTVs=`lang_published`
&where=`{"TVlang_published.value":"1"}`
]]
something like that seems to work:
[[!pdoResources?
&includeTVs=`lang_published`
&where=`{"TVlang_published.value":"1"}`
&parents=`0`
&tpl=`@INLINE [[+id]]`
&outputSeparator=`,`
&toPlaceholder=`translated_ids`
]]
debug the output: [[+translated_ids]]
[[!Archivist?
&parents=`0,0`
&target=`[[*id]]`
&where=`{"id:IN":[ [[+translated_ids]] ]}`
]]
Wow, thank you very much! Works great! I gotta spend some time understanding what is actually going on there..
Great!
So, if anyone is interested in the whole setup, read about it here:
https://github.com/Bruno17/linguaPdoTools/blob/master/README.md
pdoMenu, pdoResources and Archivist does only list translated into the current language (marked with a TV) Resources.
Archivist seems to ignore the &limit parameter.. I've tried everything from 0 to 999, but my output gets limited to 10, no matter what I do. Has this something to do with linguaPdoTools?
did you have the &limit also at the pdoResources-call?
-
☆ A M B ☆
- 3,112 Posts
have you set the context's settings?
https://rtfm.modx.com/extras/revo/lingua
in Editing the Context part
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
Hi there
We're a huge fan of lingua at my company. So we tried something unusual. We hacked into the plugin so that it produces xliffs, which are automaticaly uploaded to crowdin. And if they are ready translated, they are automaticaly fetched and we can use the translations on the site.
We use lingua mainly for the backend management and we actually hoped it would handle translated friendly urls and translated link generation. Now I saw that lingua generates links with just the language in the query but not as a furl. Did we break that feature or did it not exist in the first place?
Yours, Adrian