Feature #52074
Flexible ArraySorter
Status: | Resolved | Start date: | 2013-09-17 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | Utility | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No |
Description
The ArrayImplementation of the TYPO3.TypoScript package contains a clever mechanism to sort arrays depending on a "position string".
This functionality should be moved to the TYPO3.Flow package to allow this kind of flexible sorting in other places.
Supported position strings are:
start (<weight>):
start start 123
end (<weight>):
end end 123
before <key> (<weight>):
before foo before foo 123
after <key> (<weight>):
after foo after foo 123
<numerical-order>:
123
This feature is especially useful for sorting configuration options with multiple sources.
Example:
1SomeSetting: 2 'key1': 3 foo: 'bar' 4 position: 'start' 5 'key2': 6 foo: 'baz' 7 position: 'after key1' 8 'key3': 9 foo: 'quux' 10 position: 'end'
Associated revisions
[FEATURE] Flexible array sorter
Introduces a new utility class ``PositionalArraySorter`` that can be used to sort
an array based on a "position string".
This feature is especially useful for sorting configuration options with
multiple sources.
Example::
SomeSetting:
'key1':
foo: 'bar'
position: 'start'
'key2':
foo: 'baz'
position: 'after key1'
'key3':
foo: 'quux'
position: 'end'
possible position strings are:
- start (<weight>)
- end (<weight>)
- before <key> (<weight>)
- after <key> (<weight>)
- <numerical-order>
Usage::
$arraySorter = new PositionalArraySorter($unorderedArray);
$orderedArray = $arraySorter->toArray();
Change-Id: If7487f8724462a5ff48375eda1085a2831becf5a
Resolves: #52074
Releases: master
History
#1 Updated by Gerrit Code Review almost 2 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#2 Updated by Gerrit Code Review almost 2 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#3 Updated by Gerrit Code Review almost 2 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#4 Updated by Gerrit Code Review almost 2 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#5 Updated by Gerrit Code Review almost 2 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#6 Updated by Gerrit Code Review almost 2 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#7 Updated by Gerrit Code Review almost 2 years ago
Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#8 Updated by Gerrit Code Review almost 2 years ago
Patch set 8 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23868
#9 Updated by Bastian Waidelich almost 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 69bd32c6c0af1bb4ad10b73178a8a4a595db1777.