You are here

public function ConnectionType::getEndpointFields in RedHen CRM 8

Get all endpoint fields configured for $entity_type.

Parameters

string $entity_type: Entity type id.

string $bundle: (optional) Optional bundle to filter endpoints by.

Return value

array The field names that reference $entity_type.

Overrides ConnectionTypeInterface::getEndpointFields

File

modules/redhen_connection/src/Entity/ConnectionType.php, line 118

Class

ConnectionType
Defines the Connection type entity.

Namespace

Drupal\redhen_connection\Entity

Code

public function getEndpointFields($entity_type, $bundle = NULL) {
  $fields = [];
  foreach ($this->endpoints as $id => $endpoint) {
    if ($endpoint['entity_type'] === $entity_type && (!$bundle || in_array($bundle, $endpoint['bundles']))) {
      $fields[] = 'endpoint_' . $id;
    }
  }
  return $fields;
}