Hey!
I wanted to know if it’s possible to get in Collection-Link the title and the body and not only one field?
Thanks!
Hey!
I wanted to know if it’s possible to get in Collection-Link the title and the body and not only one field?
Thanks!
@rafaelsmith, don’t think its possible and would not make sense, let’s imagine you change the data on your linked collection, it would be out of sync… in such case why you need to access to more fields?
Thanks for your reply,
I will tell you one use case,
I try to build Home Page(with Angular) but I want to call to the server only once.
On the HP I have FAQ and Testimonials, so I want to call to the HP and some specific Questions and Testimonials,
So for FAQ I want to get: Questions and the Answers
And for Testimonials I want to get: name, content, picture, date
And all that by calling once to the HP
But if you are using the populate=1 on you requests you should have all the linked collection data
Thanks for you reply,
But I think it’s not working for me.
Result:
{
“fields”: {
“Title”: {
“name”: “Title”,
“type”: “text”,
“localize”: false,
“options”:
},
“Content”: {
“name”: “Content”,
“type”: “text”,
“localize”: false,
“options”:
},
“FAQ”: {
“name”: “FAQ”,
“type”: “collectionlink”,
“localize”: false,
“options”: {
“link”: “FAQ”
}
}
},
“entries”: [
{
“Title”: “dsadas 2”,
“Content”: “a sdf sdf sadf asd”,
“_mby”: “5cbef34133396294d100020c”,
“_by”: “5cbef34133396294d100020c”,
“_modified”: 1556527243,
“_created”: 1556018076,
“_id”: “5cbef39c33396295c3000289”,
“FAQ”: {
“_id”: “5cc05593333962da9e0003b3”,
“link”: “FAQ”,
“display”: “Why is the price so low?”
}
}
],
“total”: 1
}
*** it’s work if I put populate=1 on the URL, thanks!
But why it’s not working with singletons?
Try {"populate":1}
with quotes and without spaces.
Thanks, I will work with the params on the URL,
But when I work with multi-language I get all the languages even when I request only for en
Does this only happen with the ModuleLink Addon, or also with normal collection-links?
It’s a while ago, I wrote that addon and I never used it again. I found a better workaround for a specific problem I had, which I can’t remember anymore…
Oh - and if I remember correctly, you have to set populate:1
if you want to populate collection-links. Assigning a non-numeric value was just a hack to trigger the function without populating collection-links.
edit:
Should be fixed now in the fix-lang-fieldsFilter branch. @rafaelsmith Can you test it please? Than I’ll merge it to the master branch.
Thanks, but now when I ask for DE I get only EN and I also get the title_en or short_description_en and the rest _en
I can’t reproduce it. In my test case, I get no fields with a language suffix back.
For clarity:
Is the localized field content empty? Then the content of the default language is used. If you expect null
instead of the default fallback, add ignoreDefaultFallback
to your filter rules:
{"lang":"de","ignoreDefaultFallback":1,"populate":1,"populate_module":1}
If it is still a problem with the ModuleLink Addon, please start a new thread and provide some simplified field definitions and test data. I think, the starting topic (How to use collection-link fields correctly?) is already answered with "populate":1
. Now we’re talking about multi-language issues with a third-party addon.
Yes I work with ModuleLink Addon.
Yes I linked few collections.
English it’s my default language.
I have 3 languages, en, de, ch.
And I hope you will understand from this picture
I think, I was able to reproduce it. So it has nothing to do with the ModuleLink.
Steps to reproduce:
languages:
en: English
de: Deutsch
languages:
de: Deutsch
languages:
default: English
de: Deutsch
{"lang":"de"}
. Now it will always contain the fields with “en” suffix.I don’t really know whats happening…
I feel like every update from the panel to the Api take some time.
right now on “Products” I don’t see the DE and CH (and I have there Localize.
But on the FAQ I have it…
It shouldn’t…
In the last screenshot you disabled the lang parameter, so the intended behavior is to send all data without language filters
My advice: Take a break, drink a coffee, go for a walk. Than create two new test collections with minimal settings.
If I’m right and the issue came from changing language settings while entries still existed, it shouldn’t happen anymore in the new test collections. When you’re sure about that, have a look at your existing collections and check the field options again if they match with the test settings.
Than you have two options:
The second one is harder, because there is still no mechanism to clean non-existent entries. There are two much edge cases with automatic generated values… Some tips for cleaning are here and here. In short: Export - run a script to clean the data - import. That might be the shortest way.
Hehehe Thanks.
So yes I sent request without lang to see if I get the rest of the lang (and I didn’t got for Products as you can see).
Right now I work with CockpitCMS-Helpers but it’s not always work.
I think maybe I need to delete some collations and create new.
edit:
Ok after play with the DB and clean it + remove the CockpitCMS-Helpers it’s work good.
Thank you very much!
I’m glad, I could help. I forgot to tell you about another useful helper if you use SQLite. Direct database access: https://github.com/raffaelj/cockpit_phpLiteAdmin
Thank you, actually I thinking to move to mongodb