File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,12 @@ public function indexAction(NodeInterface $root = null)
117117 'defaultNode ' => $ this ->getNodeInDefaultDimensions ($ vocabulary )
118118 ];
119119 }
120+ usort ($ vocabularies , function (array $ vocabularyA , array $ vocabularyB ) {
121+ return strcmp (
122+ $ vocabularyA ['node ' ]->getProperty ('title ' ) ?: '' ,
123+ $ vocabularyB ['node ' ]->getProperty ('title ' ) ?: ''
124+ );
125+ });
120126
121127 $ this ->view ->assign ('taxonomyRoot ' , $ root );
122128 $ this ->view ->assign ('vocabularies ' , $ vocabularies );
@@ -245,7 +251,14 @@ public function vocabularyAction(NodeInterface $vocabulary)
245251 $ this ->view ->assign ('taxonomyRoot ' , $ root );
246252 $ this ->view ->assign ('vocabulary ' , $ vocabulary );
247253 $ this ->view ->assign ('defaultVocabulary ' , $ this ->getNodeInDefaultDimensions ($ vocabulary ));
248- $ this ->view ->assign ('taxonomies ' , $ this ->fetchChildTaxonomies ($ vocabulary ));
254+ $ taxonomies = $ this ->fetchChildTaxonomies ($ vocabulary );
255+ usort ($ taxonomies , function (array $ taxonomyA , array $ taxonomyB ) {
256+ return strcmp (
257+ $ taxonomyA ['node ' ]->getProperty ('title ' ) ?: '' ,
258+ $ taxonomyB ['node ' ]->getProperty ('title ' ) ?: ''
259+ );
260+ });
261+ $ this ->view ->assign ('taxonomies ' , $ taxonomies );
249262 }
250263
251264 /**
Original file line number Diff line number Diff line change @@ -213,6 +213,12 @@ public function getTaxonomyTreeAsArray(NodeInterface $startingPoint): array
213213 foreach ($ startingPoint ->getChildNodes () as $ childNode ) {
214214 $ result ['children ' ][] = $ this ->getTaxonomyTreeAsArray ($ childNode );
215215 }
216+ usort ($ result ['children ' ], function (array $ childA , array $ childB ) {
217+ return strcmp (
218+ $ childA ['title ' ] ?: '' ,
219+ $ childB ['title ' ] ?: ''
220+ );
221+ });
216222
217223 return $ result ;
218224 }
You can’t perform that action at this time.
0 commit comments