You are here

public function JobItemCart::isSourceItemAdded in Translation Management Tool 8

Checks if the source item has been added into the cart.

Parameters

string $plugin: The source plugin.

string $item_type: The source type.

int $source_id: The source id.

Return value

bool If the source item is in the cart.

2 calls to JobItemCart::isSourceItemAdded()
JobItemCart::addExistingJobItems in src/JobItemCart.php
Adds existing job items into the cart.
JobItemCart::addJobItem in src/JobItemCart.php
Creates a job item and adds it into the cart.

File

src/JobItemCart.php, line 92

Class

JobItemCart
Represents a job item cart.

Namespace

Drupal\tmgmt

Code

public function isSourceItemAdded($plugin, $item_type, $source_id) {
  foreach ($this
    ->getJobItemsFromCart() as $job_item) {
    if ($job_item
      ->getItemId() == $source_id && $job_item
      ->getItemType() == $item_type && $job_item
      ->getPlugin() == $plugin) {
      return TRUE;
    }
  }
  return FALSE;
}