I have site v7 that is using umbraco graphql package. I have doctype alert which I can get using query like:
{ content {
byUrl(url: "/alerts/test/") {
... on Alert {
_contentData {
name
},title
summary
}
}}}
What i want to do is before render for the summary field which is rich text edit field modify img tag. I have service to do this however I am unsure how to tap in the rendering process of graphql to intercept. I have for now got project using actual source code of umbraco graphql project.
Would I need to modify StringValueResolver and create my own StringGraphType that does the transformation?
public override Type GetGraphQLType(PublishedPropertyType propertyType)
{
if (propertyType.PropertyTypeAlias == "summary")
{
return typeof(CustomStringGraphType);
}
return propertyType.ClrType == typeof(string)
? typeof(StringGraphType)
: typeof(ListGraphType<StringGraphType>);
}
And in my CustomStringGraphType override
public override object Serialize(object value)
{
return value;
}
Modify graphql property before render
I have site v7 that is using umbraco graphql package. I have doctype alert which I can get using query like:
What i want to do is before render for the summary field which is rich text edit field modify img tag. I have service to do this however I am unsure how to tap in the rendering process of graphql to intercept. I have for now got project using actual source code of umbraco graphql project.
Would I need to modify StringValueResolver and create my own StringGraphType that does the transformation?
And in my CustomStringGraphType override
and do my transformation there?
OK so managed to get this sorted. I modified ComplexGraphTypeOfIPublishedContentExtensions.cs and around line 113 added the following:
That did it
is working on a reply...