-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended EntryInterface fields #184
base: master
Are you sure you want to change the base?
Conversation
Loves,
Some critiques,
A few more questions about the URLs,
Regarding extending the schema, this is sort of possible today but I've been quiet about it because I'd rather get these features fixed in CraftQL core and not require uses to patch them in, themselves. Basically, this should all be resolved in core since it's a core bug so thanks for raising it! |
thanks ❤️
I thought the same but for some reason
That seems to trip up the automatic resolver. I don't have enough experience to know why. :)
I'm not aware of Craft exposing that in the twig api directly. How would you solve this with the EntryConnection type? I just added the Wrapper type because i wanted to carry the
Nevermind, let's drop it 😄
Mhh… if you deal with That's not a given if you use craft as a headless solution. You could have https://foobar.org (running craft + craftql) and https://example.com (running some kind of app consuming the api). Still your url field contains "https://foobar.org"... which you're not interested in. To achieve the desired result it might be better to remove the hostname from url field instead of rebuilding it from scratch with some
That makes sense. 😁 |
Thanks @djfarly!
|
Nevermind, I see why {
entries {
uri @withLocale @normalize
}
} |
smiles, while deleting the explanation for the uri… 😄 That sounds like a super nice idea. I think it would need to be What would |
Oh, |
Nice :) Just trying to figure out what this would require:
Do I need to wire it up somewhere else in the code? |
@markhuot @djfarly is there any progress on this? or any way I can help to push this forward? Edit: CraftCMS 3.2 now allows querying entries across sites: craftcms/cms@d017022 |
Hej, thank you for this plugin! We're using it to make craft truly headless.
We ran into a few problems that we needed to solve:
uri
field is"__home__"
for the home page which is not particularly useful if you're not crafturi
field does not contain the url prefix from sites (which are used for languages in our case [/en, /de])url
field does contain the language prefix, but also contains the full url including "https://something.bla/", which again is not particularly helpful since the frontend is not necessarily hosted where the cms isTo solve this I've added some fields:
fullUri
contains a fully qualified url no matter what.site
is just the site the entry belongs tosupportedSites
is the array of supportedSites (copied from craft)alternateEntries
is an Array of a new Type calledEntryInterfaceAlternate
that just contains an Entry and a booleanisSelf
. The entries are the ones with the same id in all sites where the entry is active. Think of this as enabling you to simply make a site-(/language-)switcher based on that data.language
is just a convenience field that pulls the language from the site. (Yea... kinda unnecessary — I'm actually indifferent about this one)This code is more or less a proof of concept and I'm almost certain that my implementation is not very nice and might have some quirks. Nevertheless I'd love to make CraftQL more helpful for us.
Do you think those (or some of those) additions make sense?
How can I improve them?
If some additions do not make sense... is there a way to extend the Schema like this without needing to fork CraftQL?
Let's talk :)
Screenshot of how it looks currently: