class WorkspacesController extends AbstractModuleController (View source)

The Neos Workspaces module controller

Traits

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 $moduleConfiguration from  AbstractModuleController
protected PublishingService $publishingService
protected WorkspaceRepository $workspaceRepository
protected SiteRepository $siteRepository
protected PropertyMapper $propertyMapper
protected Context $securityContext
protected ContentContextFactory $contextFactory
protected UserService $userService
protected Translator $translator
protected PackageManager $packageManager
protected ContentDimensionPresetSourceInterface $contentDimensionPresetSource

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

Message
getErrorFlashMessage()

Display no flash message at all on errors.

void
showAction(Workspace $workspace)

No description

void
newAction()

No description

void
createAction(string $title, Workspace $baseWorkspace, string $visibility, string $description = '')

Create a workspace

void
editAction(Workspace $workspace)

Edit a workspace

void
initializeUpdateAction()

No description

void
updateAction(Workspace $workspace)

Update a workspace

void
deleteAction(Workspace $workspace)

Delete a workspace

void
rebaseAndRedirectAction(NodeInterface $targetNode, Workspace $targetWorkspace)

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

publishNodeAction(NodeInterface $node, Workspace $selectedWorkspace)

Publish a single node

discardNodeAction(NodeInterface $node, Workspace $selectedWorkspace)

Discard a a single node

publishOrDiscardNodesAction(array $nodes, string $action, Workspace $selectedWorkspace = null)

Publishes or discards the given nodes

void
publishWorkspaceAction(Workspace $workspace)

Publishes the whole workspace

void
discardWorkspaceAction(Workspace $workspace)

Discards content of the whole workspace

array
computeChangesCount(Workspace $selectedWorkspace)

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

array
computeSiteChanges(Workspace $selectedWorkspace)

Builds an array of changes for sites in the given workspace

getOriginalNode(NodeInterface $modifiedNode)

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

array
renderContentChanges(NodeInterface $changedNode)

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, NodeInterface $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(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 Message getErrorFlashMessage()

Display no flash message at all on errors.

Return Value

Message

returns false

void showAction(Workspace $workspace)

No description

Parameters

Workspace $workspace

Return Value

void

void newAction()

No description

Return Value

void

void createAction(string $title, Workspace $baseWorkspace, string $visibility, string $description = '')

Create a workspace

Parameters

string $title

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

Workspace $baseWorkspace

Workspace the new workspace should be based on

string $visibility

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

string $description

A description explaining the purpose of the new workspace

Return Value

void

void editAction(Workspace $workspace)

Edit a workspace

Parameters

Workspace $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(NodeInterface $targetNode, Workspace $targetWorkspace)

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

Parameters

NodeInterface $targetNode
Workspace $targetWorkspace

Return Value

void

publishNodeAction(NodeInterface $node, Workspace $selectedWorkspace)

Publish a single node

Parameters

NodeInterface $node
Workspace $selectedWorkspace

discardNodeAction(NodeInterface $node, Workspace $selectedWorkspace)

Discard a a single node

Parameters

NodeInterface $node
Workspace $selectedWorkspace

Exceptions

WorkspaceException

publishOrDiscardNodesAction(array $nodes, string $action, Workspace $selectedWorkspace = null)

Publishes or discards the given nodes

Parameters

array $nodes

<\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes

string $action
Workspace $selectedWorkspace

Exceptions

Exception
Exception
Exception

void publishWorkspaceAction(Workspace $workspace)

Publishes the whole workspace

Parameters

Workspace $workspace

Return Value

void

void discardWorkspaceAction(Workspace $workspace)

Discards content of the whole workspace

Parameters

Workspace $workspace

Return Value

void

protected array computeChangesCount(Workspace $selectedWorkspace)

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

Parameters

Workspace $selectedWorkspace

Return Value

array

protected array computeSiteChanges(Workspace $selectedWorkspace)

Builds an array of changes for sites in the given workspace

Parameters

Workspace $selectedWorkspace

Return Value

array

protected NodeInterface getOriginalNode(NodeInterface $modifiedNode)

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

Parameters

NodeInterface $modifiedNode

Return Value

NodeInterface

protected array renderContentChanges(NodeInterface $changedNode)

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

NodeInterface $changedNode

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, NodeInterface $changedNode)

Tries to determine a label for the specified property

Parameters

string $propertyName
NodeInterface $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(Workspace $excludedWorkspace = null)

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

Parameters

Workspace $excludedWorkspace

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

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