Skip to content

Commit

Permalink
TASK: Remove Neos.Ui.PositionalArraySorter helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Feb 14, 2024
1 parent d7932ae commit f22fb78
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
40 changes: 0 additions & 40 deletions Classes/Fusion/Helper/PositionalArraySorterHelper.php

This file was deleted.

41 changes: 41 additions & 0 deletions Classes/Fusion/Helper/RenderingModeHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Neos\Neos\Ui\Fusion\Helper;

use Neos\Eel\ProtectedContextAwareInterface;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\Model\RenderingMode;
use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Utility\PositionalArraySorter;

/**
* @internal implementation detail of the Neos Ui to build its initialState.
* only used in EEL for the configuration Neos.Neos.Ui.initialState.
*/
final class RenderingModeHelper implements ProtectedContextAwareInterface
{
/**
* @Flow\InjectConfiguration(path="userInterface.editPreviewModes", package="Neos.Neos")
* @var array<string,mixed>
*/
protected $editPreviewModes;

/**
* Returns the sorted configuration of all rendering modes {@see RenderingMode}
*
* todo: evaluate if this should be part of {@see RenderingModeService}
* @return array
*/
public function findAllSorted(): array
{
// sorting seems expected for the Neos.Ui: https://github.com/neos/neos-ui/issues/1658
return (new PositionalArraySorter($this->editPreviewModes))->toArray();
}

public function allowsCallOfMethod($methodName)
{
return true;
}
}
7 changes: 3 additions & 4 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Neos:
backgroundColor: '#ffffff'

frontendConfiguration:
editPreviewModes: '${Neos.Ui.PositionalArraySorter.sort(Configuration.setting(''Neos.Neos.userInterface.editPreviewModes''))}'
editPreviewModes: '${Neos.Ui.RenderingMode.findAllSorted()}'
# You may use this place to deliver some configuration to your custom UI components, e.g.:
# 'Your.Own:Package':
# someKey: someValue
Expand Down Expand Up @@ -101,9 +101,9 @@ Neos:
configurationDefaultEelContext:
Neos.Ui.ContentDimensions: Neos\Neos\Ui\Fusion\Helper\ContentDimensionsHelper
Neos.Ui.NodeInfo: Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper
Neos.Ui.Workspace: Neos\Neos\Ui\Fusion\Helper\WorkspaceHelper
Neos.Ui.RenderingMode: Neos\Neos\Ui\Fusion\Helper\RenderingModeHelper
Neos.Ui.StaticResources: Neos\Neos\Ui\Fusion\Helper\StaticResourcesHelper
Neos.Ui.PositionalArraySorter: Neos\Neos\Ui\Fusion\Helper\PositionalArraySorterHelper
Neos.Ui.Workspace: Neos\Neos\Ui\Fusion\Helper\WorkspaceHelper
documentNodeInformation:
metaData:
documentNode: '${Neos.Ui.NodeInfo.serializedNodeAddress(documentNode)}'
Expand Down Expand Up @@ -205,4 +205,3 @@ Neos:
Fusion:
defaultContext:
Neos.Ui.StaticResources: Neos\Neos\Ui\Fusion\Helper\StaticResourcesHelper
Neos.Ui.PositionalArraySorter: Neos\Neos\Ui\Fusion\Helper\PositionalArraySorterHelper

0 comments on commit f22fb78

Please sign in to comment.