You are here

public function CorrespondingReference::getCorrespondingFields in Corresponding Entity References 8.4

Gets an array of the corresponding field names.

Return value

array The corresponding field names.

Overrides CorrespondingReferenceInterface::getCorrespondingFields

3 calls to CorrespondingReference::getCorrespondingFields()
CorrespondingReference::getCorrespondingField in src/Entity/CorrespondingReference.php
Gets the name of the corresponding field of the provided field.
CorrespondingReference::hasCorrespondingFields in src/Entity/CorrespondingReference.php
Checks whether the given entity has the configured corresponding reference fields.
CorrespondingReference::synchronizeCorrespondingFields in src/Entity/CorrespondingReference.php
Synchronizes corresponding fields on the given entity.

File

src/Entity/CorrespondingReference.php, line 204

Class

CorrespondingReference
Defines a corresponding reference entity.

Namespace

Drupal\cer\Entity

Code

public function getCorrespondingFields() {
  $first = $this
    ->getFirstField();
  $second = $this
    ->getSecondField();
  $correspondingFields = [];
  if (!empty($first)) {
    $correspondingFields[$first] = $first;
  }
  if (!empty($second)) {
    $correspondingFields[$second] = $second;
  }
  return $correspondingFields;
}