You are here

public function ConnectionType::getEndpointEntityTypes in RedHen CRM 8

Gets all entity types for this connection type.

Parameters

string $entity_type_id: An entity type id.

string $bundle: Bundle name.

Return value

array The array of entity types.

Overrides ConnectionTypeInterface::getEndpointEntityTypes

File

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

Class

ConnectionType
Defines the Connection type entity.

Namespace

Drupal\redhen_connection\Entity

Code

public function getEndpointEntityTypes($entity_type_id, $bundle) {

  // If the current entity type is in a connection endpoint.
  if ($this
    ->getEndpointEntityTypeId(1) === $entity_type_id || $this
    ->getEndpointEntityTypeId(2) === $entity_type_id) {

    // If the current entity bundle is in a connection endpoint bundle.
    $endBundles1 = $this
      ->getEndpointBundles(1);
    $bundle1 = reset($endBundles1);
    $endBundles2 = $this
      ->getEndpointBundles(2);
    $bundle2 = reset($endBundles2);
    if ($bundle1 === $bundle || $bundle2 === $bundle) {
      return $entity_type_id;
    }
  }
  return FALSE;
}