When trying to get the JSON output of the entityqueue containing two nodes, nodes are missing from it. Is it alright? How do I get JSON of entityqueue with nodes?
{
"data":{
"type":"entity_queue--entity_queue",
"id":"3ecd6a7c-bb33-459e-8a37-51d5c44c6ea2",
"attributes":{
"uuid":"3ecd6a7c-bb33-459e-8a37-51d5c44c6ea2",
"langcode":"en",
"status":true,
"dependencies":[
"node"
],
"id":"politics",
"label":"Politics",
"handler":"simple",
"handler_configuration":[
],
"entity_settings":{
"target_type":"node",
"handler":"default:node",
"handler_settings":{
"target_bundles":{
"article":"article"
},
"sort":{
"field":"_none"
},
"auto_create":false,
"auto_create_bundle":""
}
},
"queue_settings":{
"min_size":0,
"max_size":0,
"act_as_queue":false
}
},
"links":{
"self":"http:\/\/localhost\/~peterla\/drupal\/api\/entity_queue\/entity_queue\/3ecd6a7c-bb33-459e-8a37-51d5c44c6ea2?_format=api_json"
}
},
"links":{
"self":"http:\/\/localhost\/~peterla\/drupal\/api\/entity_queue\/entity_queue\/3ecd6a7c-bb33-459e-8a37-51d5c44c6ea2?_format=api_json"
}
}
Comments
Comment #2
amateescu commentedThat's because you are exporting the Queue, which is the config entity. You need to export the subqueue, that's the content entity which holds the items.
Comment #3
petiar commentedHey @amateescu, thanks for the reply. So how do I export the subqueue, what would be the URL? Currently I am using
entity/entity_queue/politics?_format=json, wherepoliticsis my queue.Comment #4
amateescu commentedIf your queue is using the "simple subqueue" handler, then there's a subqueue with the same ID as the queue, so the URL would be
entity/entity_subqueue/politics?_format=jsonI guess :)Comment #5
petiar commentedUnfortunately, I tried that URL you proposed, but it is returning empty object. I even tried to create a JSON configuration for this, but still nothing.
Any idea what could be wrong? Items are there, I even checked in the
entity_subqueue__itemsdb table.Comment #6
amateescu commentedThe JSON configuration from #5 is still using
entity:entity_queueinstead ofentity:entity_subqueue. Maybe that's the problem?Are you using core's REST module to get the JSON representation of a subqueue?
Comment #7
petiar commentedAh, sorry, copied the wrong code. I have this in the subqueue config:
That should be ok, right? And yes, I am using the core'ß REST module. Drupal 8.2.2, cache cleared. Still empty result.
Comment #8
amateescu commentedI tried to use core's REST for the first time and it seems that the entity subqueue links definition is a bit wrong.
With this patch and using the REST UI module to enable the route for subqueues, I was able to properly see the JSON output at
/entity/entity_subqueue/<subqueue_id>?_format=json.Comment #9
amateescu commentedOops, forgot to attach the patch :)
Comment #10
petiar commentedHi @amateescu,
your patch works alright. I approve, thanks.
Comment #12
amateescu commentedCool, committed the patch to 8.x-1.x then. Thanks for testing!
Comment #13
josebc commentedLatest dev breaks subqueue page when content translation enabled, entitysubqueue is defined as a content entity so content_translation_page_attachments will try to load the canonical path
function toUrl uses 'canonical' as a default
Comment #14
rajab natshahFailed;
Capture description:
When we click "Edit items" we will get this error message
The website encountered an unexpected error. Please try again later.
and the tail for the error log will show:
Environment:
Development, Staging, Production
Steps to reproduce:
........
At this point we are getting the "The website encountered an unexpected error. Please try again later." in the site.
"No link template 'canonical' found for the 'entity_subqueue' entity type"
Comment #15
hitfactory commented@RajabNatshah, that error is caused by this bug in core #2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it. The #8 patch on that thread will stop the error.
Comment #16
rajab natshahTesting the #2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it patch ..
Comment #17
amateescu commentedBased on the testing for #2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it, setting back to fixed.