protected function ResourceFieldFileEntityReference::referencedId in RESTful 7.2
Helper function to get the referenced entity ID.
Parameters
\EntityStructureWrapper $property_wrapper: The wrapper for the referenced file array.
Return value
mixed The ID.
Overrides ResourceFieldEntityReference::referencedId
File
- src/
Plugin/ resource/ Field/ ResourceFieldFileEntityReference.php, line 86 - Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldFileEntityReference.
Class
Namespace
Drupal\restful\Plugin\resource\FieldCode
protected function referencedId($property_wrapper) {
$file_array = $property_wrapper
->value();
if (!$this->referencedIdProperty) {
return $file_array['fid'];
}
/* @var \EntityDrupalWrapper $wrapper */
$wrapper = entity_metadata_wrapper('file', $file_array['fid']);
return $wrapper->{$this->referencedIdProperty}
->value();
}