Opening this as a task, but it is a possible approach for the problem described in https://www.drupal.org/project/drupal/issues/3518668#comment-16356696 📌 Views entity rendering should use a lazy builder/placeholder Active and https://github.com/php/php-src/issues/14983
We have the following supporting things like $entity->fieldwhatever->entity;
FieldItemList
/**
* {@inheritdoc}
*/
public function __get($property_name) {
// For empty fields, $entity->field->property is NULL.
if ($item = $this->first()) {
return $item->__get($property_name);
}
}
Which calls this:
FieldItemBase
/**
* {@inheritdoc}
*/
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];
}
}
I think we could provide non-magic versions of these, e.g.:
FieldItemList
public function getFirstItem($name);
FieldItemBase
public function getValue($name);
Then you could do:
$entity->field_whatever->getFirstItem('entity');
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.