Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
I'm adding some new tabs and adjusting tab weights in a hook_quicktabs_alter()
but the new weights aren't respected when the tabs are rendered, they are just rendered in the order of the $quicktabs->tabs
array.
I'm getting around this by copying the sort function from the quicktabs_build_quicktabs()
function, but it would be nice if the sort function happened automatically or we could set a flag to re-sort them or something?
For anyone else needing to re-sort in their hook_quicktabs_alter()
, this is what I'm using:
<?php
$tabs = $quicktabs->tabs;
$weights = array();
foreach($tabs as $tab_key => $tab){
$weights[$tab_key] = $tab['weight'];
}
array_multisort($weights, SORT_ASC, $tabs);
$quicktabs->tabs = $tabs;
?>
Comments