Skip to content

Commit

Permalink
Fix: SearchPane option ordering could give a deprecated warning if nu…
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanJard committed May 12, 2023
1 parent 8aa6a3a commit 6ebc6d0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Editor/SearchPaneOptions.php
Expand Up @@ -444,9 +444,20 @@ public function exec ( $field, $editor, $http, $fields, $leftJoinIn )
// Only sort if there was no SQL order field
if ( ! $this->_order ) {
usort( $out, function ( $a, $b ) {
return is_numeric($a['label']) && is_numeric($b['label']) ?
($a['label']*1) - ($b['label']*1) :
strcmp( $a['label'], $b['label'] );
$aLabel = $a['label'];
$bLabel = $b['label'];

if ($aLabel === null) {
$aLabel = '';
}

if ($bLabel === null) {
$bLabel = '';
}

return is_numeric($aLabel) && is_numeric($bLabel) ?
($aLabel*1) - ($bLabel*1) :
strcmp( $aLabel, $bLabel );
} );
}

Expand Down

0 comments on commit 6ebc6d0

Please sign in to comment.