- π¨π³China lawxen
I found the problem still exist on an site of Drupal9.5.3
Spun off of #2574077: REST Export display cannot show any raw output for fields using the Field field handler β , dependent on commits from that issue
Problem/Motivation
If you have a view, add a REST Export display, use the Field field handler, and set "raw output" on a reference field (ie File, Image, Content, etc.), it always outputs "null" instead of an actual value.
Basically, this:
Causes this:
{
"title": "Test Page title",
"field_test_image": null,
"field_test_content_reference": null,
"field_test_taxonomy_reference": null
}
Proposed resolution
I think the issue stems from FieldItemBase::__get.
public function __get($name) {
// There is either a property object or a plain value - possibly for a
// not-defined property. If we have a plain value, directly return it.
if (isset($this->properties[$name])) {
return $this->properties[$name]->getValue();
}
elseif (isset($this->values[$name])) {
return $this->values[$name];
}
}
Files have target_id's, not names, so they get to this point and break.
Remaining tasks
Fix it
Tests
User interface changes
API changes
Data model changes
Closed: outdated
9.3
Related to the Views in Drupal Core initiative.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I found the problem still exist on an site of Drupal9.5.3