class WorkspacesController extends AbstractModuleController (View source)

The Neos Workspaces module controller

Traits

A trait to do easy backend module translations

A trait to add backend translation based on the backend users settings

Properties

protected Service $localizationService from  BackendUserTranslationTrait
protected UserService $userService from  BackendUserTranslationTrait
protected array<string,mixed> $moduleConfiguration from  AbstractModuleController
protected $translator from  ModuleTranslationTrait
protected SiteRepository $siteRepository
protected PropertyMapper $propertyMapper
protected Context $securityContext
protected UserService $domainUserService
protected PackageManager $packageManager
protected ContentRepositoryRegistry $contentRepositoryRegistry

Methods

void
initializeObject()

Set the locale according to the user settings

void
initializeAction()

No description

void
initializeView(ViewInterface $view)

No description

void
setTitle(string $title)

Use this method to set an alternative title than the module label

void
indexAction()

Display a list of unpublished content

false
getErrorFlashMessage()

Display no flash message at all on errors.

string
getModuleLabel(string $id, array $arguments = [])

No description

void
showAction(WorkspaceName $workspace)

No description

void
newAction()

No description

void
createAction(WorkspaceTitle $title, WorkspaceName $baseWorkspace, string $visibility, WorkspaceDescription $description)

Create a workspace

void
editAction(WorkspaceName $workspace)

Edit a workspace

void
initializeUpdateAction()

No description

void
updateAction(Workspace $workspace)

Update a workspace

void
deleteAction(Workspace $workspace)

Delete a workspace

void
rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorkspace)

Rebase the current users personal workspace onto the given $targetWorkspace and then redirects to the $targetNode in the content module.

void
publishNodeAction(NodeAddress $node, WorkspaceName $selectedWorkspace)

Publish a single node

void
discardNodeAction(NodeAddress $node, WorkspaceName $selectedWorkspace)

Discard a a single node

void
publishOrDiscardNodesAction(array $nodes, string $action, WorkspaceName $selectedWorkspace)

No description

void
publishWorkspaceAction(WorkspaceName $workspace)

Publishes the whole workspace

void
discardWorkspaceAction(WorkspaceName $workspace)

Discards content of the whole workspace

array
computeChangesCount(Workspace $selectedWorkspace, ContentRepository $contentRepository)

Computes the number of added, changed and removed nodes for the given workspace

array
computeSiteChanges(Workspace $selectedWorkspace, ContentRepository $contentRepository)

Builds an array of changes for sites in the given workspace

Node|null
getOriginalNode(Node $modifiedNode, ContentStreamId $baseContentStreamIdentifier, ContentRepository $contentRepository)

Retrieves the given node's corresponding node in the base content stream (that is, which would be overwritten if the given node would be published)

array
renderContentChanges(Node $changedNode, ContentStreamId $contentStreamIdentifierOfOriginalNode, ContentRepository $contentRepository)

Renders the difference between the original and the changed content of the given node and returns it, along with meta information, in an array.

string
renderSlimmedDownContent(mixed $propertyValue)

Renders a slimmed down representation of a property of the given node. The output will be HTML, but does not contain any markup from the original content.

string
getPropertyLabel(string $propertyName, Node $changedNode)

Tries to determine a label for the specified property

void
postProcessDiffArray(array $diffArray)

A workaround for some missing functionality in the Diff Renderer:

array
prepareBaseWorkspaceOptions(ContentRepository $contentRepository, Workspace $excludedWorkspace = null)

Creates an array of workspace names and their respective titles which are possible base workspaces for other workspaces.

array
prepareOwnerOptions()

Creates an array of user names and their respective labels which are possible owners for a workspace.

Details

protected void initializeObject()

Set the locale according to the user settings

Return Value

void

protected void initializeAction()

No description

Return Value

void

protected void initializeView(ViewInterface $view)

No description

Parameters

ViewInterface $view

Return Value

void

void setTitle(string $title)

Use this method to set an alternative title than the module label

Parameters

string $title

Return Value

void

void indexAction()

Display a list of unpublished content

Return Value

void

protected false getErrorFlashMessage()

Display no flash message at all on errors.

Return Value

false

string getModuleLabel(string $id, array $arguments = [])

No description

Parameters

string $id
array $arguments

Return Value

string

void showAction(WorkspaceName $workspace)

No description

Parameters

WorkspaceName $workspace

Return Value

void

void newAction()

No description

Return Value

void

void createAction(WorkspaceTitle $title, WorkspaceName $baseWorkspace, string $visibility, WorkspaceDescription $description)

Create a workspace

Parameters

WorkspaceTitle $title

Human friendly title of the workspace, for example "Christmas Campaign"

WorkspaceName $baseWorkspace

Workspace the new workspace should be based on

string $visibility

Visibility of the new workspace, must be either "internal" or "shared"

WorkspaceDescription $description

A description explaining the purpose of the new workspace

Return Value

void

Exceptions

StopActionException

void editAction(WorkspaceName $workspace)

Edit a workspace

Parameters

WorkspaceName $workspace

Return Value

void

protected void initializeUpdateAction()

No description

Return Value

void

void updateAction(Workspace $workspace)

Update a workspace

Parameters

Workspace $workspace

A workspace to update

Return Value

void

void deleteAction(Workspace $workspace)

Delete a workspace

Parameters

Workspace $workspace

A workspace to delete

Return Value

void

void rebaseAndRedirectAction(Node $targetNode, Workspace $targetWorkspace)

Rebase the current users personal workspace onto the given $targetWorkspace and then redirects to the $targetNode in the content module.

Parameters

Node $targetNode
Workspace $targetWorkspace

Return Value

void

void publishNodeAction(NodeAddress $node, WorkspaceName $selectedWorkspace)

Publish a single node

Parameters

NodeAddress $node
WorkspaceName $selectedWorkspace

Return Value

void

void discardNodeAction(NodeAddress $node, WorkspaceName $selectedWorkspace)

Discard a a single node

Parameters

NodeAddress $node
WorkspaceName $selectedWorkspace

Return Value

void

void publishOrDiscardNodesAction(array $nodes, string $action, WorkspaceName $selectedWorkspace)

No description

Parameters

array $nodes
string $action
WorkspaceName $selectedWorkspace

Return Value

void

void publishWorkspaceAction(WorkspaceName $workspace)

Publishes the whole workspace

Parameters

WorkspaceName $workspace

Return Value

void

void discardWorkspaceAction(WorkspaceName $workspace)

Discards content of the whole workspace

Parameters

WorkspaceName $workspace

Return Value

void

protected array computeChangesCount(Workspace $selectedWorkspace, ContentRepository $contentRepository)

Computes the number of added, changed and removed nodes for the given workspace

Parameters

Workspace $selectedWorkspace
ContentRepository $contentRepository

Return Value

array

protected array computeSiteChanges(Workspace $selectedWorkspace, ContentRepository $contentRepository)

Builds an array of changes for sites in the given workspace

Parameters

Workspace $selectedWorkspace
ContentRepository $contentRepository

Return Value

array

protected Node|null getOriginalNode(Node $modifiedNode, ContentStreamId $baseContentStreamIdentifier, ContentRepository $contentRepository)

Retrieves the given node's corresponding node in the base content stream (that is, which would be overwritten if the given node would be published)

Parameters

Node $modifiedNode
ContentStreamId $baseContentStreamIdentifier
ContentRepository $contentRepository

Return Value

Node|null

protected array renderContentChanges(Node $changedNode, ContentStreamId $contentStreamIdentifierOfOriginalNode, ContentRepository $contentRepository)

Renders the difference between the original and the changed content of the given node and returns it, along with meta information, in an array.

Parameters

Node $changedNode
ContentStreamId $contentStreamIdentifierOfOriginalNode
ContentRepository $contentRepository

Return Value

array

protected string renderSlimmedDownContent(mixed $propertyValue)

Renders a slimmed down representation of a property of the given node. The output will be HTML, but does not contain any markup from the original content.

Note: It's clear that this method needs to be extracted and moved to a more universal service at some point. However, since we only implemented diff-view support for this particular controller at the moment, it stays here for the time being. Once we start displaying diffs elsewhere, we should refactor the diff rendering part.

Parameters

mixed $propertyValue

Return Value

string

protected string getPropertyLabel(string $propertyName, Node $changedNode)

Tries to determine a label for the specified property

Parameters

string $propertyName
Node $changedNode

Return Value

string

protected void postProcessDiffArray(array $diffArray)

A workaround for some missing functionality in the Diff Renderer:

This method will check if content in the given diff array is either completely new or has been completely removed and wraps the respective part in or tags, because the Diff Renderer currently does not do that in these cases.

Parameters

array $diffArray

Return Value

void

protected array prepareBaseWorkspaceOptions(ContentRepository $contentRepository, Workspace $excludedWorkspace = null)

Creates an array of workspace names and their respective titles which are possible base workspaces for other workspaces.

If $excludedWorkspace is set, this workspace will be excluded from the list of returned workspaces

Parameters

ContentRepository $contentRepository
Workspace $excludedWorkspace

Return Value

array

protected array prepareOwnerOptions()

Creates an array of user names and their respective labels which are possible owners for a workspace.

Return Value

array