You are here

public function CerHandler::referenceable in Corresponding Entity References 7.2

Implements CerHandlerInterface::referenceable().

Overrides CerHandlerInterface::referenceable

1 call to CerHandler::referenceable()
CerHandler::reference in ./handler.inc
Implements CerHandlerInterface::reference().

File

./handler.inc, line 236
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 referenceable($entity) {
  $id = $this
    ->getRemoteEntityID($entity);
  $allowed = array(
    entityreference_get_selection_handler($this->local['field'], $this->local, $this->local['entity_type'], $this->entity)
      ->validateReferencableEntities(array(
      $id,
    )),
    entityreference_get_selection_handler($this->remote['field'], $this->remote, $this->remote['entity_type'], $entity)
      ->validateReferencableEntities(array(
      $this->id,
    )),
  );
  return in_array($id, $allowed[0]) && in_array($this->id, $allowed[1]);
}