Reference
Below you can view an example of the Reference block in JSON format.
{
"type": "codex_reference",
"text": null,
"marks": [],
"content": null,
"attrs": {
"blockId": "blockId",
"modelAlias": null,
"references": [
{
"entryId": "entryId",
"model": "modelAlias"
}
]
},
"contentHTML": null
}
Reference block is used for referencing entries from different models in the Rich Content field with Codex Editor. Note that when the user will type '/' in the list of block all published models will be displayed, but in the background each one of them will be created as a reference block. You can query all referenced entries in Codex GraphQL API through an extra entries
field which is added by the GraphQL engine. Read more about using reference block in GraphQL here.
type
A string that represents the type of the block. Reference blocks will always display codex_reference
as their type.
text
A string that represents the text written by the user.
marks
An array of objects that represents the marks of the block. This value can be something like bold
or italic
.
content
An array of objects that represents the content of the block.
attrs
An object that represents the attributes of the block.
attrs.blockId
A string that represents the unique block ID of the reference.
attrs.modelAlias
A string that represents alias of the model in case the reference is added only for entries from a specific models.
attrs.reference
An array of objects that represent the references entries in the block.
attrs.reference.entryId
A string that represents the id of the referenced entry.
attrs.reference.model
A string that represents the alias of the model that the reference entry belongs to.