You are here

protected function FieldInheritancePluginBase::appendData in Field Inheritance 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/FieldInheritance/FieldInheritancePluginBase.php \Drupal\field_inheritance\Plugin\FieldInheritance\FieldInheritancePluginBase::appendData()

Retrieve appended data.

Return value

string The appended data.

1 call to FieldInheritancePluginBase::appendData()
FieldInheritancePluginBase::computeValue in src/Plugin/FieldInheritance/FieldInheritancePluginBase.php
Compute the value of the field.

File

src/Plugin/FieldInheritance/FieldInheritancePluginBase.php, line 265

Class

FieldInheritancePluginBase
Abstract class FieldInheritancePluginBase.

Namespace

Drupal\field_inheritance\Plugin\FieldInheritance

Code

protected function appendData() {
  $source_entity = $this
    ->getSourceEntity();
  $destination_entity = $this
    ->getDestinationEntity();
  $values = [];
  if ($source_entity === FALSE) {
    return $values;
  }
  if (!empty($source_entity->{$this
    ->getSourceField()}
    ->getValue())) {
    $values = array_merge($values, $source_entity->{$this
      ->getSourceField()}
      ->getValue());
  }
  if (!empty($destination_entity->{$this
    ->getDestinationField()}
    ->getValue())) {
    $values = array_merge($values, $destination_entity->{$this
      ->getDestinationField()}
      ->getValue());
  }
  return $values;
}