In the Workflow module , the Entity Type workflow_transition can have attached fields using the Field UI.
When saving such an entity, the module checks if any attached fields are empty. This works fine for an Integer field, but not with an image or a file field.
For those fields, the function EntityReferenceItem::isEmpty is called, but this returns Always TRUE. See below code.
IMO there is some error in the function EntityReferenceItem::isEmpty.
This is the code:
class WorkflowTransition extends ContentEntityBase implements WorkflowTransitionInterface {
// ...
/**
* Check if anything has changed in this transition.
*
* @return bool
*/
protected function isEmpty() {
if ($this->getToSid() != $this->getFromSid()) {
return FALSE;
}
if ($this->getComment()) {
return FALSE;
}
$fields = WorkflowManager::getAttachedFields('workflow_transition', $this->bundle());
/** @var \Drupal\Core\Field\Entity\BaseFieldOverride $field */
foreach ($fields as $field_name => $field) {
if (!$this->{$field_name}->isEmpty()) { // <-- here , image and file return Always TRUE
return FALSE;
}
}
return true;
}
}