You are here

protected function AddItemToSubqueue::doExecute in Entityqueue 8

Adds the given entity to a subqueue.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be added to the subqueue.

string $subqueue_id: The ID of the subqueue where the entity will be added.

File

src/Plugin/RulesAction/AddItemToSubqueue.php, line 38

Class

AddItemToSubqueue
Provides a 'Add item to subqueue' action.

Namespace

Drupal\entityqueue\Plugin\RulesAction

Code

protected function doExecute(EntityInterface $entity, $subqueue_id) {

  /** @var \Drupal\entityqueue\EntitySubqueueInterface $subqueue */
  $subqueue = EntitySubqueue::load($subqueue_id);
  $subqueue
    ->addItem($entity)
    ->save();
}