public function WorkspaceController::add in Workspace 8
1 string reference to 'WorkspaceController::add'
File
- src/
Controller/ WorkspaceController.php, line 35
Class
- WorkspaceController
- WorkspaceController class.
Namespace
Drupal\workspace\ControllerCode
public function add() {
$types = WorkspaceType::loadMultiple();
if ($types && count($types) == 1) {
$type = reset($types);
return $this
->addForm($type);
}
if (count($types) === 0) {
return [
'#markup' => $this
->t('You have not created any Workspace types yet. Go to the <a href=":url">Workspace type creation page</a> to add a new Workspace type.', [
':url' => Url::fromRoute('entity.workspace_type.add')
->toString(),
]),
];
}
return [
'#theme' => 'workspace_add_list',
'#content' => $types,
];
}