You are here

public function EntityDefaultViewsController::getRelationshipHandlerClass in Entity API 7

Determines the handler to use for a relationship to an entity type.

Parameters

$entity_type: The entity type to join to.

$left_type: The data type from which to join.

1 call to EntityDefaultViewsController::getRelationshipHandlerClass()
EntityDefaultViewsController::map_from_schema_info in views/entity.views.inc
Comes up with views information based on the given schema and property info.

File

views/entity.views.inc, line 698
Provide views data for modules making use of the entity CRUD API.

Class

EntityDefaultViewsController
Default controller for generating basic views integration.

Code

public function getRelationshipHandlerClass($entity_type, $left_type) {

  // Look for an entity type which is used as bundle for the given entity
  // type. If there is one, allow filtering the relation by bundle by using
  // our own handler.
  foreach (entity_get_info() as $type => $info) {

    // In case we already join from the bundle entity we do not need to filter
    // by bundle entity any more, so we stay with the general handler.
    if (!empty($info['bundle of']) && $info['bundle of'] == $entity_type && $type != $left_type) {
      return 'entity_views_handler_relationship_by_bundle';
    }
  }
  return 'views_handler_relationship';
}