We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getCategorized()
1 parent 0406f74 commit fe81551Copy full SHA for fe81551
src/Mods/Tags/TagCollection.php
@@ -101,4 +101,26 @@ protected function registerItems(): void
101
));
102
}
103
104
+
105
+ /**
106
+ * Returns a list of all tags, grouped by their category.
107
+ *
108
+ * @return array<string, TagInfoInterface[]>
109
+ */
110
+ public function getCategorized() : array
111
+ {
112
+ $categories = array();
113
+ foreach($this->getAll() as $tag) {
114
+ $category = $tag->getCategory();
115
+ if(!isset($categories[$category])) {
116
+ $categories[$category] = array();
117
+ }
118
119
+ $categories[$category][] = $tag;
120
121
122
+ uksort($categories, 'strnatcasecmp');
123
124
+ return $categories;
125
126
0 commit comments