You are here

protected function EntityReference_SelectionHandler_EntityQueue::__construct in Entityqueue 7

Constructs the EntityQueue selection handler.

Overrides EntityReference_SelectionHandler_Generic::__construct

File

plugins/entityreference/selection/EntityReference_SelectionHandler_EntityQueue.class.php, line 23
Definition of EntityReference_SelectionHandler_EntityQueue.

Class

EntityReference_SelectionHandler_EntityQueue
Defines a Entityreference selection handler for Entityqueue.

Code

protected function __construct($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
  parent::__construct($field, $instance, $entity_type, $entity);
  $queue_name = NULL;
  if (!empty($entity->queue)) {
    $queue_name = $entity->queue;
  }
  elseif (!empty($instance['bundle'])) {
    $queue_name = $instance['bundle'];
  }
  if (!empty($queue_name)) {
    $this->queue = entityqueue_queue_load($queue_name);
  }

  // Override the entityreference settings with our own.
  $this->field['settings']['handler_settings']['target_bundles'] = NULL;
}