Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for label group show order and i18n names
- Loading branch information
Showing
16 changed files
with
174 additions
and
30 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
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
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
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
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
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 |
---|---|---|
|
@@ -248,6 +248,22 @@ public function getAssignedLabels($objectTypeID, array $objectIDs, $validatePerm | |
} | ||
} | ||
|
||
// order label ids by label group | ||
$labelGroups =& $this->labelGroups; | ||
foreach ($data as &$labels) { | ||
usort($labels, function($a, $b) use($labelGroups) { | ||
$groupA = $labelGroups['groups'][$a->groupID]; | ||
$groupB = $labelGroups['groups'][$b->groupID]; | ||
|
||
if ($groupA->showOrder == $groupB->showOrder) { | ||
return ($groupA->groupID > $groupB->groupID) ? 1 : -1; | ||
} | ||
|
||
return ($groupA->showOrder > $groupB->showOrder) ? 1 : -1; | ||
}); | ||
} | ||
unset($labels); | ||
|
||
return $data; | ||
} | ||
|
||
|
@@ -298,6 +314,14 @@ public function getLabelGroups(array $groupIDs = array(), $validatePermissions = | |
$data[$groupID] = $this->labelGroups['groups'][$groupID]; | ||
} | ||
|
||
uasort($data, function($a, $b) { | ||
if ($a->showOrder == $b->showOrder) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dtdesign
Author
Member
|
||
return ($a->groupID > $b->groupID) ? 1 : -1; | ||
} | ||
|
||
return ($a->showOrder > $b->showOrder) ? 1 : -1; | ||
}); | ||
|
||
return $data; | ||
} | ||
|
||
|
Oops, something went wrong.
Can't you use
LabelGroup::sortLabelGroups()
here?