protected function FieldInheritancePluginBase::fallbackData in Field Inheritance 8
Same name and namespace in other branches
- 2.0.x src/Plugin/FieldInheritance/FieldInheritancePluginBase.php \Drupal\field_inheritance\Plugin\FieldInheritance\FieldInheritancePluginBase::fallbackData()
Retrieve fallback data.
Return value
string The fallback data.
1 call to FieldInheritancePluginBase::fallbackData()
- FieldInheritancePluginBase::computeValue in src/
Plugin/ FieldInheritance/ FieldInheritancePluginBase.php - Compute the value of the field.
File
- src/
Plugin/ FieldInheritance/ FieldInheritancePluginBase.php, line 289
Class
- FieldInheritancePluginBase
- Abstract class FieldInheritancePluginBase.
Namespace
Drupal\field_inheritance\Plugin\FieldInheritanceCode
protected function fallbackData() {
$source_entity = $this
->getSourceEntity();
$destination_entity = $this
->getDestinationEntity();
$values = [];
if ($source_entity === FALSE) {
return $values;
}
if (!empty($destination_entity->{$this
->getDestinationField()}
->getValue())) {
$values = $destination_entity->{$this
->getDestinationField()}
->getValue();
}
elseif (!empty($source_entity->{$this
->getSourceField()}
->getValue())) {
$values = $source_entity->{$this
->getSourceField()}
->getValue();
}
return $values;
}