You are here

public function CorrespondingReference::getCorrespondingField in Corresponding Entity References 8.4

Gets the name of the corresponding field of the provided field.

Parameters

$fieldName string: The provided field name.

Return value

string The corresponding field name.

Overrides CorrespondingReferenceInterface::getCorrespondingField

1 call to CorrespondingReference::getCorrespondingField()
CorrespondingReference::synchronizeCorrespondingFields in src/Entity/CorrespondingReference.php
Synchronizes corresponding fields on the given entity.

File

src/Entity/CorrespondingReference.php, line 294

Class

CorrespondingReference
Defines a corresponding reference entity.

Namespace

Drupal\cer\Entity

Code

public function getCorrespondingField($fieldName) {
  $fields = $this
    ->getCorrespondingFields();
  if (count($fields) == 1) {
    return $fieldName;
  }
  unset($fields[$fieldName]);
  return array_shift($fields);
}