You are here

public function LocalTask::addTaskItem in Translation Management Tool 8

Create a task item for this task and the given job item.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item.

Overrides LocalTaskInterface::addTaskItem

File

translators/tmgmt_local/src/Entity/LocalTask.php, line 234

Class

LocalTask
Entity class for the local task entity.

Namespace

Drupal\tmgmt_local\Entity

Code

public function addTaskItem(JobItemInterface $job_item) {

  // Save the task to get an id.
  if ($this
    ->isNew()) {
    $this
      ->save();
  }
  $local_task = LocalTaskItem::create(array(
    'tltid' => $this
      ->id(),
    'tjiid' => $job_item
      ->id(),
  ));
  $local_task
    ->save();
  return $local_task;
}