What happened?
Description
I want to start by saying, thanks for adding the new "Full data" option #16237 it's awesome.
When trying it out I found a discrepancy in the behaviour of the label field in graphql and twig.
It seems that in graphql the label is only the value of the optional label field.
But in twig if the label field is empty the label property will contain the element title or a nice representation of the url.
Steps to reproduce
- Create a link field and add the option for the label and url suffix (not sure if it's needed)
- create a graphql query to read the label field.
- create a twig file to read the label.
- create two link fields one where the label is set and one where only the entry is set.
Expected behavior
Label behaviour in twig and graphql is the same, meaning if the label field is empty it get's filled by another string derived from the value.
Actual behavior
GraphQl field value is only the content of the label field.
Workaround
In js
link.label ?? link.elementTitle ?? (link.value ? new URL(link.value).hostname : '')
Craft CMS version
5.6.5.1
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
I want to start by saying, thanks for adding the new "Full data" option #16237 it's awesome.
When trying it out I found a discrepancy in the behaviour of the label field in graphql and twig.
It seems that in graphql the label is only the value of the optional label field.
But in twig if the label field is empty the label property will contain the element title or a nice representation of the url.
Steps to reproduce
Expected behavior
Label behaviour in twig and graphql is the same, meaning if the label field is empty it get's filled by another string derived from the value.
Actual behavior
GraphQl field value is only the content of the label field.
Workaround
In js
Craft CMS version
5.6.5.1
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions