You are here

abstract class EntityQueueHandlerBase in Entityqueue 7

An abstract implementation of EntityQueueHandlerInterface.

Hierarchy

Expanded class hierarchy of EntityQueueHandlerBase

File

plugins/entityqueue/handler/base.inc, line 97
Contains Entityqueue handler interface and base class.

View source
abstract class EntityQueueHandlerBase implements EntityQueueHandlerInterface {

  /**
   * The handler plugin definition.
   *
   * @var array
   */
  protected $plugin;

  /**
   * The EntityQueue object.
   *
   * @var EntityQueue
   */
  protected $queue;
  public static function getInstance(EntityQueue $queue) {
    $entity_type = $queue->target_type;

    // Check if the entity type does exist and has a base table.
    $entity_info = entity_get_info($entity_type);
    if (empty($entity_info['base table'])) {
      return BrokenEntityQueueHandler::getInstance($queue);
    }

    // Check if the queue handler exists.
    ctools_include('plugins');
    $plugin = ctools_get_plugins('entityqueue', 'handler', $queue->handler);
    if (empty($plugin)) {
      return BrokenEntityQueueHandler::getInstance($queue);
    }
    return new $plugin['class']($queue);
  }
  protected function __construct(EntityQueue $queue) {
    $this->queue = $queue;
    ctools_include('plugins');
    $plugin = ctools_get_plugins('entityqueue', 'handler', $this->queue->handler);
    $this->plugin = $plugin;
  }
  public function settingsForm() {
    return array();
  }
  public function subqueueForm(EntitySubqueue $subqueue, &$form_state) {
    return array();
  }
  public function getTargetTypeLabel() {
    $entity_info = entity_get_info($this->queue->target_type);
    if (!empty($entity_info['base table'])) {
      return $entity_info['label'];
    }
    return '<em>' . t('Missing entity type (@type)', array(
      '@type' => $this->queue->target_type,
    )) . '</em>';
  }
  public function getHandlerLabel() {
    return $this->plugin['title'];
  }
  public function getSubqueueLabel(EntitySubqueue $subqueue) {
  }
  public function canDeleteSubqueue(EntitySubqueue $subqueue) {
    return TRUE;
  }
  public function create() {
  }
  public function load() {
  }
  public function loadFromCode() {
  }
  public function preSave() {
  }
  public function insert() {
  }
  public function update() {
  }
  public function preDelete() {
  }
  public function postDelete() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityQueueHandlerBase::$plugin protected property The handler plugin definition.
EntityQueueHandlerBase::$queue protected property The EntityQueue object.
EntityQueueHandlerBase::canDeleteSubqueue public function Returns TRUE if subqueue can be deleted, otherwise returns FALSE. Overrides EntityQueueHandlerInterface::canDeleteSubqueue 1
EntityQueueHandlerBase::create public function Act on creating a queue. Overrides EntityQueueHandlerInterface::create
EntityQueueHandlerBase::getHandlerLabel public function Returns the label of the queue's handler. Overrides EntityQueueHandlerInterface::getHandlerLabel 1
EntityQueueHandlerBase::getInstance public static function Factory function: creates a new instance of this handler for a queue. Overrides EntityQueueHandlerInterface::getInstance 1
EntityQueueHandlerBase::getSubqueueLabel public function Returns the label of a given subqueue. Overrides EntityQueueHandlerInterface::getSubqueueLabel 2
EntityQueueHandlerBase::getTargetTypeLabel public function Returns the entity type label of a queue target type. Overrides EntityQueueHandlerInterface::getTargetTypeLabel
EntityQueueHandlerBase::insert public function Act after a new queue is saved. Overrides EntityQueueHandlerInterface::insert 1
EntityQueueHandlerBase::load public function Act on loading a queue. Overrides EntityQueueHandlerInterface::load
EntityQueueHandlerBase::loadFromCode public function Act on loading a queue that is defined only in code. Overrides EntityQueueHandlerInterface::loadFromCode 1
EntityQueueHandlerBase::postDelete public function Act after deleting a queue. Overrides EntityQueueHandlerInterface::postDelete
EntityQueueHandlerBase::preDelete public function Act before deleting a queue. Overrides EntityQueueHandlerInterface::preDelete
EntityQueueHandlerBase::preSave public function Act before a queue is saved. Overrides EntityQueueHandlerInterface::preSave
EntityQueueHandlerBase::settingsForm public function Generates a settings form for this handler. Overrides EntityQueueHandlerInterface::settingsForm 1
EntityQueueHandlerBase::subqueueForm public function Generates an add/edit subqueue form for this handler. Overrides EntityQueueHandlerInterface::subqueueForm 2
EntityQueueHandlerBase::update public function Act after a queue is updated. Overrides EntityQueueHandlerInterface::update
EntityQueueHandlerBase::__construct protected function