public function ConflictListBuilder::load in Workspace 8
Load the entities needed for the table.
Parameters
string $workspace_id: The workspace ID to build the conflict list for.
Return value
\Drupal\Core\Entity\EntityInterface[] An array of entities. An array of entities.
See also
workspace_preprocess_workspace_rev
1 call to ConflictListBuilder::load()
- ConflictListBuilder::buildList in src/
Controller/ Component/ ConflictListBuilder.php - Build the render array to display on the page.
File
- src/
Controller/ Component/ ConflictListBuilder.php, line 186
Class
- ConflictListBuilder
- A list builder for entity revision conflicts.
Namespace
Drupal\workspace\Controller\ComponentCode
public function load($workspace_id) {
/** \Drupal\multiversion\Entity\Workspace $workspace */
$workspace = Workspace::load($workspace_id);
$conflicts = $this->conflictTracker
->useWorkspace($workspace)
->getAll();
$entity_revisions = [];
foreach ($conflicts as $uuid => $conflict) {
// @todo figure out why this is an array and what to do if there is more than 1
// @todo what happens when the conflict value is not "available"? what does this mean?
$conflict_keys = array_keys($conflict);
$rev = reset($conflict_keys);
$rev_info = $this->revisionIndex
->useWorkspace($workspace_id)
->get("{$uuid}:{$rev}");
if (!empty($rev_info['revision_id'])) {
$entity_revisions[] = $this->entityTypeManager
->getStorage($rev_info['entity_type_id'])
->useWorkspace($workspace_id)
->loadRevision($rev_info['revision_id']);
}
}
return $entity_revisions;
}