You are here

public function CerHandler::__construct in Corresponding Entity References 7.2

Implements CerHandlerInterface::__construct().

Overrides CerHandlerBase::__construct

File

./handler.inc, line 158
Contains base code for CER handlers, which are objects responsible for creating, updating and deleting corresponding references between entities.

Class

CerHandler
@class Generic CER handler with rudimentary language handling.

Code

public function __construct($preset, $entity) {
  parent::__construct($preset);

  // If $entity is of the wrong type, entity_extract_IDs()
  // will throw EntityMalformedException here.
  $extract_ids = entity_extract_IDs($this->local['entity_type'], $entity);
  $this->id = array_shift($extract_ids);
  $this->entity = $entity;
}