contentful / rich-text.php

Utilities for the Contentful Rich Text
https://www.contentful.com
MIT License
12 stars 9 forks source link

LinkResolverInterface #58

Closed Raymond-Ly closed 3 years ago

Raymond-Ly commented 3 years ago

Hello,

I am confused with what the LinkResolverInterface argument should be. I am following the example in https://github.com/contentful/rich-text.php#parsing

Screenshot 2021-05-26 at 12 59 57

Trying to parse multiple nodeType: paragraph which returns a Contentful\RichText\Node\Document

Sebb767 commented 3 years ago

Hi @ray-itech ,

the documentation is, unfortunately, a bit outdated at the moment. Refreshing that is on my TODO-List. For now, you can create a link resolver via:

$resolver = new \Contentful\Delivery\LinkResolver($client, $client->getResourcePool());

where $client is your Delivery SDK client. You usually also don't need to parse rich text data when received via the SDK, it already does that for you.

If you're using the Management SDK, you can create a link resolver via:

$resolver = new \Contentful\Management\LinkResolver($client, new \Contentful\Management\ApiConfiguration(), new \Contentful\Management\RequestUriBuilder());

In the next update I'll include a method to directly create the resolver from the client. Hope this helps!

Raymond-Ly commented 3 years ago

Hello @Sebb767 ,

Thanks for the response, this helps 😃