function WorkspaceListBuilder::render
Same name in other branches
- 9 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::render()
- 8.9.x core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::render()
- 10 core/modules/workspaces/src/WorkspaceListBuilder.php \Drupal\workspaces\WorkspaceListBuilder::render()
Overrides EntityListBuilder::render
File
-
core/
modules/ workspaces/ src/ WorkspaceListBuilder.php, line 203
Class
- WorkspaceListBuilder
- Defines a class to build a listing of workspace entities.
Namespace
Drupal\workspacesCode
public function render() {
$build = parent::render();
if ($this->isAjax()) {
$this->offCanvasRender($build);
}
else {
// Add a row for switching to Live.
$has_active_workspace = $this->workspaceManager
->hasActiveWorkspace();
$row_live = [
'data' => [
'label' => [
'data' => [
'#markup' => $this->t('Live'),
],
],
'owner' => '',
'operations' => [
'data' => [
'#type' => 'operations',
'#links' => [
'activate' => [
'title' => 'Switch to Live',
'weight' => 0,
'url' => Url::fromRoute('workspaces.switch_to_live', [], [
'query' => $this->getDestinationArray(),
]),
],
],
'#access' => $has_active_workspace,
],
],
],
];
if (!$has_active_workspace) {
$row_live['class'] = [
'active-workspace',
'active-workspace--default',
];
}
array_unshift($build['table']['#rows'], $row_live);
$build['#attached'] = [
'library' => [
'workspaces/drupal.workspaces.overview',
],
];
}
return $build;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.