You are here

public function WorkspaceController::addForm in Workspace 8

1 call to WorkspaceController::addForm()
WorkspaceController::add in src/Controller/WorkspaceController.php
1 string reference to 'WorkspaceController::addForm'
workspace.routing.yml in ./workspace.routing.yml
workspace.routing.yml

File

src/Controller/WorkspaceController.php, line 56

Class

WorkspaceController
WorkspaceController class.

Namespace

Drupal\workspace\Controller

Code

public function addForm(WorkspaceTypeInterface $workspace_type) {
  $upstream_id = $this->workspaceSettings
    ->get('upstream');
  if (!$upstream_id) {
    $upstream_id = $this
      ->getDefaultWorkspacePointer()
      ->id();
  }
  $workspace = Workspace::create([
    'type' => $workspace_type
      ->id(),
    'upstream' => $upstream_id,
    'pull_replication_settings' => $this->workspaceSettings
      ->get('pull_replication_settings', ''),
    'push_replication_settings' => $this->workspaceSettings
      ->get('push_replication_settings', ''),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($workspace);
}