Skip to content

Commit a7c94e3

Browse files
committed
TASK: Fix PromotedElementsCreationHandler to work with new references api
1 parent 60b3b10 commit a7c94e3

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Classes/Infrastructure/ContentRepository/CreationDialog/PromotedElementsCreationHandlerFactory.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public function handle(NodeCreationCommands $commands, NodeCreationElements $ele
4040
$setReferencesCommands = [];
4141
foreach ($elements as $elementName => $elementValue) {
4242
// handle properties
43-
// todo this will be simplified once hasProperty does not return true for references
44-
if ($nodeType->hasProperty($elementName) && ($nodeType->getPropertyType($elementName) !== 'references' && $nodeType->getPropertyType($elementName) !== 'reference')) {
43+
if ($nodeType->hasProperty($elementName)) {
4544
$propertyConfiguration = $nodeType->getProperties()[$elementName];
4645
if (
4746
($propertyConfiguration['ui']['showInCreationDialog'] ?? false) === true
@@ -52,10 +51,9 @@ public function handle(NodeCreationCommands $commands, NodeCreationElements $ele
5251
}
5352

5453
// handle references
55-
// todo this will be replaced by $nodeType->hasReference()
56-
if ($nodeType->hasProperty($elementName) && ($nodeType->getPropertyType($elementName) === 'references' || $nodeType->getPropertyType($elementName) === 'reference')) {
54+
if ($nodeType->hasReference($elementName)) {
5755
assert($elementValue instanceof NodeAggregateIds);
58-
$referenceConfiguration = $nodeType->getProperties()[$elementName];
56+
$referenceConfiguration = $nodeType->getReferences()[$elementName];
5957
if (
6058
($referenceConfiguration['ui']['showInCreationDialog'] ?? false) === true
6159
) {

Tests/Unit/CreationDialogNodeTypePostprocessorTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function setUp(): void
3333
public function processCopiesInspectorConfigurationToCreationDialogElements(): void
3434
{
3535
$configuration = [
36+
'references' => [],
3637
'properties' => [
3738
'somePropertyName' => [
3839
'ui' => [
@@ -215,6 +216,8 @@ public function processRespectsEditorDefaultConfiguration(): void
215216
public function processConvertsCreationDialogConfiguration(): void
216217
{
217218
$configuration = [
219+
'references' => [],
220+
'properties' => [],
218221
'ui' => [
219222
'creationDialog' => [
220223
'elements' => [
@@ -307,6 +310,8 @@ public function processConvertsCreationDialogConfiguration(): void
307310
]);
308311

309312
$expectedResult = [
313+
'references' => [],
314+
'properties' => [],
310315
'ui' => [
311316
'creationDialog' => [
312317
'elements' => [
@@ -403,6 +408,8 @@ public function processConvertsCreationDialogConfiguration(): void
403408
public function processDoesNotThrowExceptionIfNoCreationDialogEditorCanBeResolved(): void
404409
{
405410
$configuration = [
411+
'references' => [],
412+
'properties' => [],
406413
'ui' => [
407414
'creationDialog' => [
408415
'elements' => [

0 commit comments

Comments
 (0)