I'm looking to get rid of the "all" tab and replace it with a tab containing a custom block..

Or keep it and add the new tab (probably get rid of it though..)

I am not sure how to do this, (although I'm thinking it shouldn't be too difficult) I'm thinking some change to this function:

/**
* Generate a renderable group widget.
*/

function commons_bw_generate_group_widget($group) {
  $settings = array('style' => 'Commons Pills', 'ajax' => FALSE, 'html' => TRUE);
  // Load the default tab definitinos.
  $tabs = commons_bw_get_tab_definitions('group');
  foreach ($tabs as $key => $tab) {
    // Populate the group argument.
    $tabs[$key]['args'] = $group->nid;
    // Add the result count for Tabs that are of the type 'view';
    if ($tab['type'] == 'view') {
      $view = views_get_view($tab['vid']);
      if (isset($tab['display'])) {
        $view->set_display($tab['display']);
      }
      $view->set_arguments(array($group->nid));
      $view->get_total_rows = TRUE;
      $view->execute();
      $tabs[$key]['title'] = t($tabs[$key]['title']) . ' <span class="commons-bw-result-count">'. $view->total_rows . '</span>';
    }
    // Set the default tab.
    if (isset($tabs[$key]['default']) && $tabs[$key]['default']) {
      $settings['default_tab'] = $key;
    }
  }

  // Generate the Quicktabs instance.
  return quicktabs_build_quicktabs('commons_bw', $settings, $tabs);
}

any pointers would be appreciated..

CommentFileSizeAuthor
#5 commons_bw_quicktabs.patch780 bytesAnonymous (not verified)
#4 MY_MODULE.zip2.55 KBLaz5530

Comments

J77J’s picture

This has me beat...

I have tried following the instructions here:

https://drupal.org/node/1782922

To no avail.. I even copied the entire commons_posts folder to my new module, swapping out "posts" for my content type...

Nothing.

The new content type shows in the all tab, I just cant get another tab with that type to show..

Anyone have any ideas?

J77J’s picture

Component: Code » Groups
Laz5530’s picture

With this can you create a new tab in BW and link it to you view.
The whole thing is pretty complecated. And theres no Description :(

/**
* Implements hook_commons_bw_group_widget().
*/
function YOURMODUL_commons_bw_group_widget() {
return array(
'YOUR_MODUL' => array(
'title' => 'TITLE_OF_TAB',
'type' => 'view',
'vid' => 'YOUR_VIEW(computer readable name)',
'display' => 'default',
'weight' => 1,
),
);
}

I hope it helps.

Laz5530’s picture

Title: Add tab to browsing widget » How to add custom tab to commons browsing widget
StatusFileSize
new2.55 KB

Hi,
i have seen many have the problem adding custom tab to the browsing widget.
I had this problem too and found no documentation (just this issue). So after i solved this i thought i share it with you.

Here is an example module for a custom tab for custom contenttype.

  • In the code you should replace every 'MY_...' (for example MY_CONTENTTYPE with the name of your contenttype).
  • You must first create a new view 'commons_bw_MY_CONTENTTYPE'(or copy,rename,edit 'commons_bw_post')
Anonymous’s picture

StatusFileSize
new780 bytes

Hi,
I'm working with the same task, but I don't want to create new view for my tab. So if I just make implements hook_commons_bw_group_widget() I can create tab with various type, for example, with next code:

function theory_commons_bw_commons_bw_group_widget()
{
  return array(
        'commons_theory' => array(
            'title' => 'Theory',
            'contents' => get_theory_by_gid($gid), // get some content 
            'weight' => 10,
        ),
    );
}

But at the page with this quicktabs I have the notice:
Notice: Undefined index: type in function commons_bw_generate_group_widget() (line 84 in file \profiles\commons\modules\contrib\commons_bw\commons_bw.module
so maybe it's helpful to make patch with correct check type for creating different types of quicktabs not only views?

ceepeebee’s picture

There are several ways how you could get rid of the "all" tab:
1. tell commons not to create it in the first place: you would have to alter the commons_bw.module source code and you don't want to do that
2. write your own module
3. fastest approach: use css just for not showing the tab: (be aware the functionality stays accessible)

#quicktabs-commons_bw ul.quicktabs-tabs li:first-child  {
display: none;
} /* this will only work, if the "all"-tab is the first tab */
ceepeebee’s picture

Status: Active » Closed (fixed)

I know, this issue is the original and strictly speaking #2129517: Step By Step Guide: How To create your custom Group Content Type and its Browsing Widget Tab is the duplicate, but the latter seemed to be the proper place to put a step-by-step how-to (considering the fact that it was re-opend anyways).
marking this one as fixed