class WorkspaceController extends AbstractModuleController (View source)

internal  for communication within the Workspace UI only
 

The Neos Workspace module controller

Traits

Utility trait for retrieving node types for nodes with a built-in fallback mechanism

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 ContentRepositoryRegistry $contentRepositoryRegistry
protected $defaultViewObjectName
protected NodeUriBuilderFactory $nodeUriBuilderFactory
protected SiteRepository $siteRepository
protected PropertyMapper $propertyMapper
protected Context $securityContext
protected UserService $userService
protected PackageManager $packageManager
protected WorkspacePublishingService $workspacePublishingService
protected WorkspaceService $workspaceService
protected NodeLabelGeneratorInterface $nodeLabelGenerator
protected Translator $translator
protected PolicyService $policyService
protected ContentRepositoryAuthorizationService $authorizationService

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(Sorting|null $sorting = null)

Display a list of unpublished content

getErrorFlashMessage()

Display no flash message at all on errors.

getNodeType(Node $node) deprecated

No description

void
reviewAction(WorkspaceName $workspace)

No description

void
newAction()

No description

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

No description

void
editAction(WorkspaceName $workspaceName)

Edit a workspace

void
updateAction(WorkspaceName $workspaceName, WorkspaceTitle $title, WorkspaceDescription $description, string $visibility, WorkspaceName|null $baseWorkspace = null)

Update a workspace

void
deleteAction(WorkspaceName $workspaceName)

Delete a workspace

void
publishDocumentAction(string $nodeAddress, WorkspaceName $selectedWorkspace)

Publish a single document node

void
discardDocumentAction(string $nodeAddress, WorkspaceName $selectedWorkspace)

Discard a single document node

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

No description

void
publishWorkspaceAction(WorkspaceName $workspace)

Publishes the whole workspace

void
confirmPublishAllChangesAction(WorkspaceName $workspaceName)

No description

void
confirmDiscardAllChangesAction(WorkspaceName $workspaceName)

No description

void
confirmPublishSelectedChangesAction(WorkspaceName $workspaceName)

No description

void
confirmDiscardSelectedChangesAction(WorkspaceName $workspaceName)

No description

void
discardWorkspaceAction(WorkspaceName $workspace)

Discards content of the whole workspace

void
rebaseAction(WorkspaceName $workspaceName, bool $force)

Rebase a workspace

void
rebaseConfirmAction(WorkspaceName $workspaceName, int $conflictCount)

Confirm force rebase a workspace

computePendingChanges(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, WorkspaceName $baseWorkspaceName, 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)

renderContentChanges(Node $changedNode, ContentStreamId $contentStreamIdOfOriginalNode, ContentRepository $contentRepository)

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

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, WorkspaceName|null $editedWorkspaceName)

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

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

No description

getWorkspaceListItems(ContentRepository $contentRepository)

No description

getChangesFromWorkspace(Workspace $selectedWorkspace, ContentRepository $contentRepository)

No description

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(Sorting|null $sorting = null)

Display a list of unpublished content

Parameters

Sorting|null $sorting

Return Value

void

protected getErrorFlashMessage()

Display no flash message at all on errors.

protected NodeType getNodeType(Node $node) deprecated

deprecated to ease migration from Neos 8.3

No description

Parameters

Node $node

Return Value

NodeType

void reviewAction(WorkspaceName $workspace)

No description

Parameters

WorkspaceName $workspace

Return Value

void

void newAction()

No description

Return Value

void

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

No description

Parameters

WorkspaceTitle $title
WorkspaceName $baseWorkspace
WorkspaceDescription $description
string $visibility

Return Value

void

void editAction(WorkspaceName $workspaceName)

Edit a workspace

Parameters

WorkspaceName $workspaceName

The name of the workspace that is being edited

Return Value

void

void updateAction(WorkspaceName $workspaceName, WorkspaceTitle $title, WorkspaceDescription $description, string $visibility, WorkspaceName|null $baseWorkspace = null)

Update a workspace

Parameters

WorkspaceName $workspaceName

The name of the workspace that is being updated

WorkspaceTitle $title

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

WorkspaceDescription $description

A description explaining the purpose of the new workspace

string $visibility

Allow other editors to collaborate on this workspace if set to "shared"

WorkspaceName|null $baseWorkspace

The base workspace to rebase this workspace onto if modified

Return Value

void

void deleteAction(WorkspaceName $workspaceName)

Delete a workspace

Parameters

WorkspaceName $workspaceName

Return Value

void

Exceptions

StopActionException

void publishDocumentAction(string $nodeAddress, WorkspaceName $selectedWorkspace)

Publish a single document node

Parameters

string $nodeAddress
WorkspaceName $selectedWorkspace

Return Value

void

void discardDocumentAction(string $nodeAddress, WorkspaceName $selectedWorkspace)

Discard a single document node

Parameters

string $nodeAddress
WorkspaceName $selectedWorkspace

Return Value

void

Exceptions

WorkspaceRebaseFailed

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

No description

Parameters

array $nodes
string $action
WorkspaceName $workspace

Return Value

void

void publishWorkspaceAction(WorkspaceName $workspace)

Publishes the whole workspace

Parameters

WorkspaceName $workspace

Return Value

void

void confirmPublishAllChangesAction(WorkspaceName $workspaceName)

No description

Parameters

WorkspaceName $workspaceName

Return Value

void

void confirmDiscardAllChangesAction(WorkspaceName $workspaceName)

No description

Parameters

WorkspaceName $workspaceName

Return Value

void

void confirmPublishSelectedChangesAction(WorkspaceName $workspaceName)

No description

Parameters

WorkspaceName $workspaceName

Return Value

void

void confirmDiscardSelectedChangesAction(WorkspaceName $workspaceName)

No description

Parameters

WorkspaceName $workspaceName

Return Value

void

void discardWorkspaceAction(WorkspaceName $workspace)

Discards content of the whole workspace

Parameters

WorkspaceName $workspace

Return Value

void

void rebaseAction(WorkspaceName $workspaceName, bool $force)

Rebase a workspace

Parameters

WorkspaceName $workspaceName
bool $force

Return Value

void

void rebaseConfirmAction(WorkspaceName $workspaceName, int $conflictCount)

Confirm force rebase a workspace

Parameters

WorkspaceName $workspaceName
int $conflictCount

Return Value

void

protected PendingChanges computePendingChanges(Workspace $selectedWorkspace, ContentRepository $contentRepository)

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

Parameters

Workspace $selectedWorkspace
ContentRepository $contentRepository

Return Value

PendingChanges

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, WorkspaceName $baseWorkspaceName, 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
WorkspaceName $baseWorkspaceName
ContentRepository $contentRepository

Return Value

Node|null

protected ContentChangeItems renderContentChanges(Node $changedNode, ContentStreamId $contentStreamIdOfOriginalNode, ContentRepository $contentRepository)

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

Parameters

Node $changedNode
ContentStreamId $contentStreamIdOfOriginalNode
ContentRepository $contentRepository

Return Value

ContentChangeItems

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, WorkspaceName|null $editedWorkspaceName)

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

If $editedWorkspace is set, this workspace and all its nested workspaces will be excluded from the list of returned workspaces

Parameters

ContentRepository $contentRepository
WorkspaceName|null $editedWorkspaceName

Return Value

array

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

No description

Parameters

string $id
array $arguments
mixed $quantity

Return Value

string

protected WorkspaceListItems getWorkspaceListItems(ContentRepository $contentRepository)

No description

Parameters

ContentRepository $contentRepository

Return Value

WorkspaceListItems

protected Changes getChangesFromWorkspace(Workspace $selectedWorkspace, ContentRepository $contentRepository)

No description

Parameters

Workspace $selectedWorkspace
ContentRepository $contentRepository

Return Value

Changes