Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doxter Behavior #9

Merged
merged 2 commits into from
Aug 22, 2017
Merged

Doxter Behavior #9

merged 2 commits into from
Aug 22, 2017

Conversation

markhuot
Copy link
Owner

Adds support for a Doxter field type

@markhuot markhuot mentioned this pull request Aug 22, 2017
@StevenLangbroek
Copy link

Queries work like a charm 💯

@markhuot
Copy link
Owner Author

FYI, I updated this with a breaking change. In general I'm trying to match CraftQL as closely as I can to Craft's own Twig API. By default Doxter returns DoxterData to the template which exposes {{ entry.doxterField }} for the parsed HTML and {{ entry.doxterField.getRaw() }} for the raw markdown. CraftQL returning an object and not the parsed html when seemed "different" when accessed through { entries { ...on News { doxterField } } }.

With this update, calling the naked field now returns the parsed HTML, as you would get in a Twig template. However, if you want the raw Markdown you can pass an argument of raw:true (aligning to .getRaw()). Like this:

{
  entries {
    ...on News {
      parsedHtml: doxterField
      rawMarkdown: doxterField(raw:true)
    }
  }
}

Sorry for the change, but I like this implementation better.

@markhuot markhuot merged commit d23ede2 into master Aug 22, 2017
@markhuot markhuot deleted the doxter branch August 22, 2017 13:27
@StevenLangbroek
Copy link

Definitely agree, it's nice! Did you consider what to do with filters yet? I think they would be a good conceptual match to GraphQL's directives... Maybe start discussing on an issue?

@markhuot
Copy link
Owner Author

markhuot commented Aug 22, 2017

Yup, a separate issue would be best. webonyx/graphql-php supports the built in @include and @skip directives, but adding some custom directives would be interesting.

@mattstein
Copy link

FWIW, I just submitted a PR for Doxter when I noticed this behavior left the CraftQL codebase. I'm only getting started with CraftQL/GraphQL, but it was pretty straightforward to get it working!

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

Successfully merging this pull request may close these issues.

3 participants