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

BUGFIX: Sort properties in raw content mode #4957

Merged
merged 1 commit into from Apr 11, 2024

Conversation

Sebobo
Copy link
Member

@Sebobo Sebobo commented Mar 22, 2024

Previously there was no obvious sorting for properties in the Raw content mode and the resulting order of properties appeared "random", which is an issue if the properties don't appear in the order the editor should edit them.

With this change the sorting option which is also used for the inspector is used to sort the items and therefore giving an option to the integrator on their arrangement.

That the inspector order is used for the raw content is not the cleanest solution, but introducing another sorting option also doesn't seem the right choice at this point.

@@ -1,7 +1,12 @@
prototype(Neos.Neos:RawContent.NodeProperties) < prototype(Neos.Fusion:Component) {
@private {
items = ${node.nodeType.properties}
items.@process.sort = ${Neos.Ui.PositionalArraySorter.sort(value, 'ui.inspector.position')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry nope :D

Neos.Ui.PositionalArraySorter.sort is ONLY for the NeosUi bootstrap and was cleaned up wiht 9.0.x

Also we should not introduce another dependency to the Ui in Neos.Neos see #4951

Copy link
Member Author

@Sebobo Sebobo Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right sorry, completely overlooked that 🤦
Sooooooo another Helper in Neos then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah or we use Neos.Array and put there a positional helper on it and mark it as internal (the whole helper is internal / experimental)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the adjustments and added the sorting method via the Neos.Array helper.

@Sebobo Sebobo force-pushed the bugfix/sort-raw-content-properties branch from 14c74cf to 0ee0be1 Compare April 11, 2024 06:56
@Sebobo Sebobo requested a review from mhsdesign April 11, 2024 06:57
Copy link
Member

@mficzel mficzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by 👀

/**
* Sorts the input array by the $positionProperty of each element.
*/
public function sortByPosition(array $set, $positionPropertyPath = 'position'): array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to call this one sortByKey or sortBy instead:

Suggested change
public function sortByPosition(array $set, $positionPropertyPath = 'position'): array
public function sortByKey(array $set, $positionPropertyPath = 'position'): array

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather sortByPropertyPath?
Key would be incorrect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, also fine with me even though it's not really a property

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function sortByPosition(array $set, $positionPropertyPath = 'position'): array
public function sortByPropertyPath(array $set, $positionPropertyPath = 'position'): array

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the adjustment

Previously there was no obvious sorting.
With this change the sorting option which is also used for the inspector is used to
sort the items and therefore giving an option to the integrator on their arrangement.

This changes introduces the sortByPosition method into the Neos.Array Eel helper to make the PositionalArraySorter available in Fusion.
@Sebobo Sebobo force-pushed the bugfix/sort-raw-content-properties branch from 0ee0be1 to f15a8c0 Compare April 11, 2024 08:25
@Sebobo Sebobo requested a review from bwaidelich April 11, 2024 08:29
Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet, thx!

@Sebobo Sebobo merged commit a0d616d into 8.3 Apr 11, 2024
9 checks passed
@Sebobo Sebobo deleted the bugfix/sort-raw-content-properties branch April 11, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants