protected function ChangesListController::getTask in Workspace 8
Create a task using workspace info.
Parameters
\Drupal\multiversion\Entity\WorkspaceInterface $entity:
$field_name:
Return value
\Drupal\replication\ReplicationTask\ReplicationTask
1 call to ChangesListController::getTask()
- ChangesListController::getChangesBetweenRemoteWorkspaces in src/
Controller/ ChangesListController.php - Return the array with changed entities when target is a remote workspace.
File
- src/
Controller/ ChangesListController.php, line 387
Class
Namespace
Drupal\workspace\ControllerCode
protected function getTask(WorkspaceInterface $entity, $field_name) {
$task = new ReplicationTask();
$items = $entity
->get($field_name);
if (!$items instanceof EntityReferenceFieldItemListInterface) {
throw new LogicException('Replication settings field does not exist.');
}
$referenced_entities = $items
->referencedEntities();
if (count($referenced_entities) > 0) {
$task
->setFilter($referenced_entities[0]
->getFilterId());
$task
->setParameters($referenced_entities[0]
->getParameters());
}
return $task;
}