class ContentElementWrappingService (View source)

The content element wrapping service adds the necessary markup around a content element such that it can be edited using the Content Module of the Neos Backend.

Properties

protected PrivilegeManagerInterface $privilegeManager
protected AuthorizationService $nodeAuthorizationService
protected HtmlAugmenter $htmlAugmenter
protected SessionInterface $session
protected UserLocaleService $userLocaleService
protected NodeInfoHelper $nodeInfoHelper
protected ContentRepositoryRegistry $contentRepositoryRegistry
protected Node> $renderedNodes

All editable nodes rendered in the document

protected string $nonRenderedContentNodeMetadata

String containing <script> tags for non rendered nodes

Methods

__construct()

No description

string|null
wrapContentObject(Node $node, string $content, string $fusionPath, array $additionalAttributes = [])

Wrap the $content identified by $node with the needed markup for the backend.

string
wrapCurrentDocumentMetadata(Node $node, string $content, string $fusionPath, array $additionalAttributes = [], Node|null $siteNode = null)

No description

array
addGenericEditingMetadata(array $attributes, Node $node)

Collects metadata attributes used to allow editing of the node in the Neos backend.

array
addNodePropertyAttributes(array $attributes, Node $node)

Adds node properties to the given $attributes collection and returns the extended array

array
renderNodePropertyAttribute(Node $node, string $propertyName)

Renders data attributes needed for the given node property.

array
addDocumentMetadata(ContentRepository $contentRepository, array $attributes, Node $node, Node|null $siteNode)

Collects metadata for the Neos backend specifically for document nodes.

array
addCssClasses(array $attributes, Node $node, array $initialClasses = [])

Add required CSS classes to the attributes.

void
appendNonRenderedContentNodeMetadata(Node $documentNode)

Concatenate strings containing <script> tags for all child nodes not rendered within the current document node. This way we can show e.g. content collections within the structure tree which are not actually rendered.

void
clearRenderedNodesArray()

Clear rendered nodes helper array to prevent possible side effects.

void
clearNonRenderedContentNodeMetadata()

Clear non rendered content node metadata to prevent possible side effects.

string
getNonRenderedContentNodeMetadata(Node $documentNode)

No description

string
dasherize(string $value)

Converts camelCased strings to lower cased and non-camel-cased strings

bool
needsMetadata(Node $node, ContentRepository $contentRepository, bool $renderCurrentDocumentMetadata)

No description

Details

__construct()

No description

string|null wrapContentObject(Node $node, string $content, string $fusionPath, array $additionalAttributes = [])

Wrap the $content identified by $node with the needed markup for the backend.

Parameters

Node $node
string $content
string $fusionPath
array $additionalAttributes

Return Value

string|null

string wrapCurrentDocumentMetadata(Node $node, string $content, string $fusionPath, array $additionalAttributes = [], Node|null $siteNode = null)

No description

Parameters

Node $node
string $content
string $fusionPath
array $additionalAttributes

additional attributes in the form ['' => '', ...] to be rendered in the element wrapping

Node|null $siteNode

Return Value

string

protected array addGenericEditingMetadata(array $attributes, Node $node)

Collects metadata attributes used to allow editing of the node in the Neos backend.

Parameters

array $attributes
Node $node

Return Value

array

protected array addNodePropertyAttributes(array $attributes, Node $node)

Adds node properties to the given $attributes collection and returns the extended array

Parameters

array $attributes
Node $node

Return Value

array

the merged attributes

protected array renderNodePropertyAttribute(Node $node, string $propertyName)

Renders data attributes needed for the given node property.

Parameters

Node $node
string $propertyName

Return Value

array

protected array addDocumentMetadata(ContentRepository $contentRepository, array $attributes, Node $node, Node|null $siteNode)

Collects metadata for the Neos backend specifically for document nodes.

Parameters

ContentRepository $contentRepository
array $attributes
Node $node
Node|null $siteNode

Return Value

array

protected array addCssClasses(array $attributes, Node $node, array $initialClasses = [])

Add required CSS classes to the attributes.

Parameters

array $attributes
Node $node
array $initialClasses

Return Value

array

protected void appendNonRenderedContentNodeMetadata(Node $documentNode)

Concatenate strings containing <script> tags for all child nodes not rendered within the current document node. This way we can show e.g. content collections within the structure tree which are not actually rendered.

Parameters

Node $documentNode

Return Value

void

Exceptions

Exception

protected void clearRenderedNodesArray()

Clear rendered nodes helper array to prevent possible side effects.

Return Value

void

protected void clearNonRenderedContentNodeMetadata()

Clear non rendered content node metadata to prevent possible side effects.

Return Value

void

string getNonRenderedContentNodeMetadata(Node $documentNode)

No description

Parameters

Node $documentNode

Return Value

string

Exceptions

Exception

protected string dasherize(string $value)

Converts camelCased strings to lower cased and non-camel-cased strings

Parameters

string $value

Return Value

string

protected bool needsMetadata(Node $node, ContentRepository $contentRepository, bool $renderCurrentDocumentMetadata)

No description

Parameters

Node $node
ContentRepository $contentRepository
bool $renderCurrentDocumentMetadata

Return Value

bool