Skip to content
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

Doesn't return array in graph ql #96

Closed
gorelegacy opened this issue Mar 25, 2022 · 6 comments
Closed

Doesn't return array in graph ql #96

gorelegacy opened this issue Mar 25, 2022 · 6 comments

Comments

@gorelegacy
Copy link

The linkit field doesn't return an array in the craft graph ql.

It only returns a string "<a href="https://www.instagram.com/" target="_blank" rel="noopener noreferrer">Instagram</a>"

instead of an array that contains the url, text, customText, target etc like you can do in twig

@samhibberd
Copy link
Collaborator

Hi @gorelegacy we have actually added support for Craft Graph QL in the upcoming release (along with eager support and some other stuff).

We don’t currently use gl and as a result don’t have a great deal of experience with it.

We have some final testing before getting the release out, but if you wanted to check out the develop branch and have a test that would be really really useful.

Happy to chat through on Discord if you had any questions / feedback.

@JayBox325
Copy link

This is a feature I'd be very interested in getting added. Watching.

@samhibberd
Copy link
Collaborator

@JayBox325 if you wanted to test this feature then grab the develop branch, would value any feedback. It also includes eager loading support.

@JayBox325
Copy link

JayBox325 commented Apr 13, 2022

Hi @samhibberd, I'll use it on a project I'm working on at the moment.

My current approach to this though, if @gorelegacy was interested, was this helper function using `html-react-parser':

import Parser from 'html-react-parser';

const buttonProps = Parser(String(button))

const {
    href,
    rel,
    target,
    children
} = buttonProps.props || {}

which creates the following:
image

Which I found to be a great solution for now where 'children' is my label, and the rest are all props for the a tag. Beaut.

@samhibberd
Copy link
Collaborator

@JayBox325
Copy link

I updated linkit last week and thoroughly enjoyed seeing this. Didn't enjoy the timing of how it happened the day of production deployment, but it was so quick to alter my markup. Well done, great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants