class NodeTypeSchemaBuilder (View source)

Renders the Node Type Schema in a format the User Interface understands; additionally pre-calculating node constraints

Properties

protected NodeTypeManager $nodeTypeManager

Methods

array
generateNodeTypeSchema()

The preprocessed node type schema contains everything we need for the UI:

void
flattenAlohaFormatOptions(array $options)

In order to allow unsetting options via the YAML settings merging, the formatting options can be set via 'option': true, however, the frontend schema expects a flattened plain numeric array. This methods adjust the setting accordingly.

array
generateConstraints()

Generate the list of allowed sub-node-types per parent-node-type and child-node-name.

Details

array generateNodeTypeSchema()

The preprocessed node type schema contains everything we need for the UI:

  • "nodeTypes" contains the original (merged) node type schema
  • "inheritanceMap.subTypes" contains for every parent type the transitive list of subtypes
  • "constraints" contains for each node type, the list of allowed child node types; normalizing allowlists and excludelists:
    • [node type]
    • nodeTypes:
    • childNodes:
      • [child node name]
      • nodeTypes:

Return Value

array

the node type schema ready to be used by the JavaScript code

protected void flattenAlohaFormatOptions(array $options)

In order to allow unsetting options via the YAML settings merging, the formatting options can be set via 'option': true, however, the frontend schema expects a flattened plain numeric array. This methods adjust the setting accordingly.

Parameters

array $options

The options array, passed by reference

Return Value

void

protected array generateConstraints()

Generate the list of allowed sub-node-types per parent-node-type and child-node-name.

Return Value

array constraints