Skip to main content
edited title
Source Link

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/services/ecommerce?_format=json (may need to run in Firefox)) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

Edit: The title was edited and became misleading! The content is using ?_format=json not the JSON:API

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/services/ecommerce?_format=json) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

Edit: The title was edited and became misleading! The content is using ?_format=json not the JSON:API

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/services/ecommerce?_format=json (may need to run in Firefox)) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

Edit: The title was edited and became misleading! The content is using ?_format=json not the JSON:API

edited title
Source Link

How to get the title of a referenced entity with JSON:API`?_format=json`?

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/knowledge-base/ecommerce?_format=jsonhttps://cms.huytonweb.com/services/ecommerce?_format=json) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

Edit: The title was edited and became misleading! The content is using ?_format=json not the JSON:API

How to get the title of a referenced entity with JSON:API?

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/knowledge-base/ecommerce?_format=json) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

How to get the title of a referenced entity with `?_format=json`?

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/services/ecommerce?_format=json) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated

Edit: The title was edited and became misleading! The content is using ?_format=json not the JSON:API

edited title
Link
mona lisa
  • 6.3k
  • 2
  • 20
  • 26

Entity reference field has no How to get the title in jsonof a referenced entity with JSON:API?

Source Link
Loading