You are here

public function TMGMTJobItemUICart::addJobItem in Translation Management Tool 7

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

TMGMTJobItem|null Added job item. If the item exists NULL is returned.

File

ui/includes/tmgmt_ui.cart.inc, line 87
Contains TMGMTJobItemUICart.

Class

TMGMTJobItemUICart
Represents a job item cart.

Code

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->tjiid;
  return $job_item;
}