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
Conversation
@@ -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')} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
14c74cf
to
0ee0be1
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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:
public function sortByPosition(array $set, $positionPropertyPath = 'position'): array | |
public function sortByKey(array $set, $positionPropertyPath = 'position'): array |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function sortByPosition(array $set, $positionPropertyPath = 'position'): array | |
public function sortByPropertyPath(array $set, $positionPropertyPath = 'position'): array |
There was a problem hiding this comment.
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.
0ee0be1
to
f15a8c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet, thx!
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.