function WorkspaceListBuilder::buildRow
Same name in other branches
- 8.9.x core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::buildRow()
- 10 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::buildRow()
- 11.x core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::buildRow()
Overrides EntityListBuilder::buildRow
File
-
core/
modules/ workspaces/ src/ WorkspaceListBuilder.php, line 106
Class
- WorkspaceListBuilder
- Defines a class to build a listing of workspace entities.
Namespace
Drupal\workspacesCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\workspaces\WorkspaceInterface $entity */
if (isset($entity->_depth) && $entity->_depth > 0) {
$indentation = [
'#theme' => 'indentation',
'#size' => $entity->_depth,
];
}
$row['data'] = [
'label' => [
'data' => [
'#prefix' => isset($indentation) ? $this->renderer
->render($indentation) : '',
'#type' => 'link',
'#title' => $entity->label(),
'#url' => $entity->toUrl(),
],
],
'owner' => $entity->getOwner()
->getDisplayName(),
];
$row['data'] = $row['data'] + parent::buildRow($entity);
$active_workspace = $this->workspaceManager
->getActiveWorkspace();
if ($active_workspace && $entity->id() === $active_workspace->id()) {
$row['class'] = [
'active-workspace',
'active-workspace--not-default',
];
}
return $row;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.