Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Move node creation dialog stuff to the Neos.Neos.Ui #4630

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ protected function setGlobalUiElementLabels(string $nodeTypeName, array &$config
}
}

// todo ui.creationDialog logic should rather reside in the Neos.Neos.Ui
$creationDialogConfiguration = Arrays::getValueByPath($configuration, 'ui.creationDialog.elements');
if (is_array($creationDialogConfiguration)) {
$creationDialogConfiguration = &$configuration['ui']['creationDialog']['elements'];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
class DefaultPropertyEditorPostprocessor implements NodeTypePostprocessorInterface
{
/**
* @var array
* @phpstan-var array<string,mixed>
* @var array<string,mixed>
* @Flow\InjectConfiguration(package="Neos.Neos", path="userInterface.inspector.dataTypes")
*/
protected $dataTypesDefaultConfiguration;

/**
* @var array
* @phpstan-var array<string,mixed>
* @var array<string,mixed>
* @Flow\InjectConfiguration(package="Neos.Neos", path="userInterface.inspector.editors")
*/
protected $editorDefaultConfiguration;
Expand Down Expand Up @@ -93,48 +91,5 @@ public function process(NodeType $nodeType, array &$configuration, array $option
$propertyConfiguration['ui']['inspector']['editor'] = $editor;
}
}
unset($propertyConfiguration);
if (
isset($configuration['ui']['creationDialog']['elements'])
&& is_array($configuration['ui']['creationDialog']['elements'])
) {
foreach ($configuration['ui']['creationDialog']['elements'] as &$elementConfiguration) {
if (!isset($elementConfiguration['type'])) {
continue;
}

$type = $elementConfiguration['type'];
$defaultConfigurationFromDataType = $this->dataTypesDefaultConfiguration[$type] ?? [];

// FIRST STEP: Figure out which editor should be used
// - Default: editor as configured from the data type
// - Override: editor as configured from the property configuration.
if (isset($elementConfiguration['ui']['editor'])) {
$editor = $elementConfiguration['ui']['editor'];
} elseif (isset($defaultConfigurationFromDataType['editor'])) {
$editor = $defaultConfigurationFromDataType['editor'];
} else {
// No exception since the configuration could be a partial configuration overriding a property
// with showInCreationDialog flag set
continue;
}

// SECOND STEP: Build up the full UI configuration by merging:
// - take configuration from editor defaults
// - take configuration from dataType
// - take configuration from creationDialog elements (NodeTypes)
$mergedUiConfiguration = $this->editorDefaultConfiguration[$editor] ?? [];
$mergedUiConfiguration = Arrays::arrayMergeRecursiveOverrule(
$mergedUiConfiguration,
$defaultConfigurationFromDataType
);
$mergedUiConfiguration = Arrays::arrayMergeRecursiveOverrule(
$mergedUiConfiguration,
$elementConfiguration['ui'] ?? []
);
$elementConfiguration['ui'] = $mergedUiConfiguration;
$elementConfiguration['ui']['editor'] = $editor;
}
}
}
}
4 changes: 2 additions & 2 deletions Neos.Neos/Documentation/References/NodeTypeDefinition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ The following options are allowed for defining a NodeType:
``editorListeners`` (removed since Neos 3.3)
This feature has been removed in favor of `Depending Properties`_ with Neos 3.3

``showInCreationDialog`` (since Neos 5.1)
If `true` the corresponding property will appear in the Node Creation Dialog. Editor configuration
``showInCreationDialog``
If `true` the corresponding property will be promoted into the Node Creation Dialog. Editor configuration
will be copied from the respective ``ui.inspector`` settings in that case and can be overridden with
the ``creationDialog.elements.<propertyName>``, see `Node Creation Dialog Configuration`_

Expand Down
8 changes: 0 additions & 8 deletions Neos.Neos/NodeTypes/Mixin/Content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
constraints:
nodeTypes:
'*': false
postprocessors:
'CreationDialogPostprocessor':
position: 'after NodeTypePresetPostprocessor'
postprocessor: 'Neos\Neos\NodeTypePostprocessor\CreationDialogPostprocessor'
options:
nodeCreationHandlers:
creationDialogProperties:
nodeCreationHandler: 'Neos\Neos\Ui\NodeCreationHandler\CreationDialogPropertiesCreationHandler'
ui:
label: i18n
icon: 'icon-square-o'
Expand Down
11 changes: 0 additions & 11 deletions Neos.Neos/NodeTypes/Mixin/Document.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
# explicitly disallow to create a homepage below a regular document
'Neos.Neos:Site': false
'Neos.Neos:Document': true
postprocessors:
'CreationDialogPostprocessor':
position: 'after NodeTypePresetPostprocessor'
postprocessor: 'Neos\Neos\NodeTypePostprocessor\CreationDialogPostprocessor'
options:
nodeCreationHandlers:
documentTitle:
nodeCreationHandler: 'Neos\Neos\Ui\NodeCreationHandler\DocumentTitleNodeCreationHandler'
creationDialogProperties:
nodeCreationHandler: 'Neos\Neos\Ui\NodeCreationHandler\CreationDialogPropertiesCreationHandler'
ui:
label: 'Document'
group: 'general'
Expand All @@ -45,7 +35,6 @@
ui:
label: i18n
reloadPageIfChanged: true
showInCreationDialog: true
inspector:
group: 'document'
validation:
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Resources/Private/Schema/NodeTypes.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ additionalProperties:

'inline': { type: ['null', 'dictionary'] }

'showInCreationDialog': { type: ['null', 'boolean'], description: 'If this property should occur on the CreationDialog of the corresponding node. Inspector configuration is applied from "ui.inspector" configuration in that case' }
'showInCreationDialog': { type: ['null', 'boolean'], description: 'If this property should be promoted into the CreationDialog of the corresponding node. Inspector configuration is applied from "ui.inspector" configuration in that case' }

'inspector':
type:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<trans-unit id="properties._hiddenInIndex" xml:space="preserve" approved="yes">
<source>Hide in menus</source>
<target state="final">In Menüs verbergen</target></trans-unit>
<trans-unit id="creationDialog.title" xml:space="preserve" approved="yes">
<source>Title</source>
<target state="final">Titel</target></trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<trans-unit id="properties._hiddenInIndex" xml:space="preserve">
<source>Hide in menus</source>
</trans-unit>
<trans-unit id="creationDialog.title" xml:space="preserve">
<source>Title</source>
</trans-unit>
</body>
</file>
</xliff>
Loading
Loading