public function JobItemCart::addJobItem in Translation Management Tool 8
Creates a job item and adds it into the cart.
Parameters
string $plugin: The source plugin.
string $item_type: The source item type.
$item_id: The source item id.
Return value
JobItem|null Added job item. If the item exists NULL is returned.
File
- src/
JobItemCart.php, line 68
Class
- JobItemCart
- Represents a job item cart.
Namespace
Drupal\tmgmtCode
public function addJobItem($plugin, $item_type, $item_id) {
if ($this
->isSourceItemAdded($plugin, $item_type, $item_id)) {
return NULL;
}
$job_item = tmgmt_job_item_create($plugin, $item_type, $item_id);
$job_item
->save();
$this->cart[] = $job_item
->id();
return $job_item;
}