public function RenderCheeseburgerMenuBlock::bubbleSortWeight in Cheeseburger Menu 8.2
Same name and namespace in other branches
- 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::bubbleSortWeight()
- 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::bubbleSortWeight()
Bubble sort menus.
1 call to RenderCheeseburgerMenuBlock::bubbleSortWeight()
- RenderCheeseburgerMenuBlock::renderTree in src/
Controller/ RenderCheeseburgerMenuBlock.php - Render given tree.
File
- src/
Controller/ RenderCheeseburgerMenuBlock.php, line 688 - Controller used for rendering block.
Class
- RenderCheeseburgerMenuBlock
- Class RenderCheeseburgerMenuBlock.
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function bubbleSortWeight($sort) {
do {
$change = FALSE;
for ($i = 0; $i < count($sort) - 1; $i++) {
if ($sort[$i]['weight'] > $sort[$i + 1]['weight']) {
$temp = $sort[$i];
$sort[$i] = $sort[$i + 1];
$sort[$i + 1] = $temp;
$change = TRUE;
}
}
} while ($change == TRUE);
return $sort;
}