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.
I'm using OpenIdeaL with i18n in a multilingual website. For the most part, it all works out pretty well. The issue I'm having is with the ideal_main.module. In default language (English) the Idea count is properly displayed in the Ideas in Action tab (in the Ideas page). But when I switch to French, the tab titles are properly translated but the count disappears.
How can I change this function so that counter are shown for all languages?
/**
* Implements hook_quicktabs_alter()
* Add counter to quicktab title.
*/
function ideal_main_quicktabs_alter(&$quicktabs) {
$quicktabs_to_alter = array("all_ideas", "ideas_by_category", "in_action");
if (in_array($quicktabs->machine_name, $quicktabs_to_alter)) {
foreach ($quicktabs->tabs as $key => $tab){
// find what quicktab instance we're in, and what block this is
$block = substr($tab['bid'], strpos($tab['bid'], "block"));
$view = substr($tab['bid'], 0, strpos($tab['bid'], "block")-1);
$view = substr($view, strpos($view, "delta")+6);
// if this is one of the tabs we want to add the counter to
if ($view == "ideas_in_action" || ($block == "block_5" && ($view == "ideas_by_category" || $view == "ideas_all"))) {
$count = ideal_main_quicktabs_view_counter($view, $block);
$quicktabs->tabs[$key]['title'] .= " (" . $count . ")";
}
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | no quicktab count in French.jpg | 39.85 KB | bisonbleu |
Comments
Comment #1
bisonbleu CreditAttribution: bisonbleu commentedFormatting for php
Comment #2
bisonbleu CreditAttribution: bisonbleu commentedHere's what I mean. Note the absence of (count) in the French UI. Doing a demo in Vegas Thursday; would be nice if...
Comment #3
bisonbleu CreditAttribution: bisonbleu commentedSetting to Bug report. Hoping to resolve this issue before Christmas
*<//:{)}}}