-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Theme Export: Sort theme.json properties
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Generic helper functions | ||
* | ||
* @since 6.0 | ||
*/ | ||
|
||
/** | ||
* Sorts the keys of an array alphabetically. | ||
* The array is passed by reference so it doesn't get returned | ||
* which mimiks the behaviour of ksort. | ||
* | ||
* @param array $array The array to sort, passed by reference. | ||
*/ | ||
function gutenberg_recursive_ksort( &$array ) { | ||
foreach ( $array as &$value ) { | ||
if ( is_array( $value ) ) { | ||
gutenberg_recursive_ksort( $value ); | ||
} | ||
} | ||
ksort( $array ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters