As of PHP 7.2 a bug in PHP has been resolved, that was allowing a mismatch between method definitions in interfaces and their implementations in classes/traits. As a consequence the $include_computed
parameter had to be removed from \Drupal\Core\Field\FieldItemList::getValue()
, so that the method matches its definition in the interface \Drupal\Core\TypedData\TypedDataInterface::getValue()
, where it is specified without a parameter.
There was no real implementation that would retrieve all the computed properties in core. The only job that was done was that \Drupal\Core\Field\FieldItemList::getValue()
was propagating the parameter to each of the items when retrieving their values through ::getValue()
.
Therefore the only affected cases would be field item classes that are implementing the method getValue()
with the $include_computed
parameter and return a computed value when the parameter is provided i.e. set to TRUE
. In this case those fields will lose this ability as \Drupal\Core\Field\FieldItemList::getValue()
does not have any parameter to propagate anymore.
If this functionality is still needed there is an another way of retrieving all the properties of a field including the computed ones:
$field_values = [];
foreach ($entity->get($field_name) as $delta => $field_item) {
foreach ($field_item->getProperties(TRUE) as $property_name => $property) {
$field_values[$delta][$property_name] = $property->getValue();
}
}