Attached is a style plugin for tabs. Now that Vertical Tabs is in Drupal core, I think it makes sense to have a "tabs" display style in panels core.

One item needs work: I couldn't seem to find the right Pane title variable to grab for the tab text. I am forcing it to lookup the "Overridden title" for now. Thoughts on how to do this properly?

Also: field_group module provides a wonderful 'horizontal_tabs' style based on the same structure of a vertical tab. With one line of code, I can detect the module exists and add "horizontal" to the options.

Merlin, I know you are against things like this generally, but since its so small I was hoping we could let it in.

Comments

subscribe

Nothing displays in the panel when I choose the tabs styling

Priority:Normal» Major

ffs, please implement vertical tabs in Panels.

we need it badly for D6 and D7 version.

totally defeats the purpose of using Panels for node edit form if we can't use some vertical tabs...

Priority:Major» Normal

Ok. First, I'm not against this. I have, however, been focused heavily on Views and core CTools functionality lately, and haven't had time to scour the Panels queue. Sorry about that, but I don't have 3 brains. Wish I did.

Second: Don't swear at me about features.

Third: There is never a NEED to have something in core that could be in a contrib module. If you NEED it, then create the contrib module and do it. There is no way this is higher than normal priority in any way, especially because if you NEED it, you can have it. Today. Right now.

Finally: I'll have to review the code. With vertical tabs in core this isn't necessarily a bad thing, though the way the style system has become, this isn't exactly the kind of thing that really feels right for regions. That said, there isn't a better solution, so there's nothing wrong with it, per se.

(For what it's worth, what I really want is a 'container' pane that you can turn into this kind of stuff, rather than a region style).

Re: Finally twice: LPCA: DON'T SWEAR AT ME ABOUT FEATURES.

Seriously, what gives you the right to treat anyone else that way? Your karma--.

sorry, i was distressed and frustrated, because it's something i've been wanting to have for so long... and so for long i have been testing modules to no avail.
i didn't meant to curse anyone or swear, i just wanted to emphasize the issue.

i really think this needs to be done, sooner or later, and if it was packaged with Panels, that would be better - until it is stable, well yeah, maybe a contrib module.

but having the idea posted here might just call up efforts for that.

something like Vertical Tabs
or hortizontal tabs
or fieldsets
any or all options, would be a good idea IMO

Subbing.
Certainly would make a nice feature.

+1

I just started testing;
http://drupal.org/project/vertical_tabs_panel_style
and its working quite well.

@brianmercer, is there a D7 version?

Not that I know of. It's not my module, but the code has worked well so far in D6.

horizontal tabs do work:
http://drupal.org/project/panels_tabs

There is a D7 port of panels_tabs in Amitaibu's git sandbox, mentioned here: http://drupal.org/node/1036672#comment-4756048

Hi, for anyone happening upon this post - this is a great plugin that works for Vertical AND Horizontal tabs in Panels!

I also wanted to put in my 2 cents and would like to see this rolled in to Panels. I've had this patch by careernerd installed on my D7 sites for months, and it's been invaluable to me. I dropped the patch into sites/all/themes/mytheme/plugins/styles/tabs.inc, by placing in this folder I am able to update the Panels module without loosing this custom plugin. Check out some of the screenshots to see how easy it is to tabify the panel content with this simple 2k plugin.

@drupleg
Could you please make it clear that which patch you are talking about

I'm referring to careernerd's original patch that started this thread - http://drupal.org/files/issues/tabs.inc_.patch

I just downloaded it, renamed it to tabs.inc, and put it in my therme folder sites/all/themes/mytheme/plugins/styles/tabs.inc

delete douple post, dadgum mobile browsers :/

+1

StatusFileSize
new2.81 KB

Fixed a couple of issues with the patch. '%title' used when overriding the title now displays as expected from the selected context.

I didn't address this:

You may use %keywords from contexts...

...as I wasn't quite sure what it was used for. However I fixed tab items so they no longer appear in reversed order compared to the arranged order of the panes.

I thought this patch was quite neat and tidy. With the updated version I've attached you can apply it as you would normally apply a patch (remember to use the -p1 option if applying it from the module base directory).

Worked with Panels 7.x-3.2 though the plugin should work on other 7.x-3.x Panels versions.

Recently I’ve been playing with Panopoly which at its core has some very nice alterations to Panels. So (forgive my anti-social behavior) I forked some of the core modules in Panopoly to fix some bugs and add my own. Panopoly comes with a jQuery UI accordion style plugin I . I incorporated the Panels Tabs project and this Vertical Tabs plugin patch. These are three style plugins that all confront the same problems.

The vertical tabs patch on this issue failed to handle titles correctly. Panopoly Accordion did similar things, apparently requiring an overridden title for the accordion to work correctly. Panels Tabs did something more tedious: it stores titles in a static cache during hook_panels_pane_content_alter() and later retrieved that title when the region was being rendered. That's opaque.

A better solution is to allow region styles to specify a “pane style,” which is the name of the plugin that should be used for all panes in that region. During hook_panels_pre_render, loop through the panel settings to determine the style in use for a given region. If that region has a pane style, the pane style overwrites the style of all panes in that region. Currently, pane style settings are completely ignored when the region’s style enforces a “pane style.” The plugin can specify itself as the pane style, in which case the “render pane” callback needs to be written to produce the markup your widget style needs.

@bangpound - there's a pretty significant amount of code in your module vs. the patch. The original idea of this issue was to try and coax tabs into Panels core, especially since (as the original author @Jon Pugh pointed out) Vertical tabs are in Drupal core.

Your module inspired me to go back and check the updated patch I submitted - what a surprise when I found the patch didn't work! The patch was pretty hacky, but then something might have changed in CTools since as well. It's better now (see attached). The only problem remaining is that certain types of content may need their title to be overriden still, this is uncommon, and for things such as the comment form. Custom content, nodes, etc, all work fine.

I noticed with your module it displayed the title reliably! And there's accordion configuration options. This is nice. Plus being a module, you can just turn it on or off. On the other hand though, when I put the comment form in a tab, the comment subject form field escaped the bounds of the panel under your style. This didn't occur for me with the patch. Perhaps because of the amount of things going on with the module, as opposed to how little is done with the patch, there's more to be done to ensure things work as intended. You're pre-processing template files, etc.

I've attached an updated version of the patch (tested with Panels 7.x-3.2 and CTools 7.x-1.0) in continuing with something the author described as ..."so small I was hoping we could let it in". There is that annoying issue of needing to override the title when it does not appear, but this workaround makes the patch work well enough for me. It will probably need more work, but will have to wait to find out!

Edit:

This patch leverages the horizontal tabs used by Field group (7.x-1.1). Install the Field group module in addition to this patch to use horizontal tabs.

Assigned:Jon Pugh» Unassigned

The original idea of this issue was to try and coax tabs into Panels core, especially since (as the original author @Jon Pugh pointed out) Vertical tabs are in Drupal core .

So is jQuery UI part of Drupal core. The plugins I've provided also render the title correctly without having to override it for each pane.

If you're working on this patch as a single plugin, it won't ever work. You either need to wrestle the titles into the region style or you need to coax the region style to impose itself on its panes' styles. The former requires opaque code and static caching. The latter requires overloading the style plugin info with new properties.

If you want to meet the original demands of this issue, you need hook_panels_pre_render and vertical_tabs.inc plugin.

While the "so small I was hoping we could let it in" idea is right on, the broken title support necessarily means it should never go in. Implementing the UI widgets like tabs and accordion is deceptively easy--target a region (container) with a lot of panes (tabs)--but the obvious path leads to broken titles.

The problem is a fundamental shortcoming in how style plugins work in Panels. Style plugins are completely independent of each other at render time, but pane styles are rendered inside region and display style output, and for these widget style plugins, the region and the pane styles have to be synchronized.

there's a pretty significant amount of code in your module vs. the patch.

Yes, it contains a lot of irrelevant stuff for this issue. However, for this kind of plugin to work, you must implement hook_panels_pre_render. I did not submit it as a patch on this issue but as a demonstration of the dependencies of this issue.

The title rendering messiness is something that actually got changed; it used to be easier to do this, but we needed the pane rendering to be more atomic. :/

I really need, someday, to create container panes. Then this whole messy business can be put to bed.

@bangpound - I tried to implement what you put forth going by everything you said in your last post and the previous one. I worked off your code as an example trying to get the template_preprocess_panels_pane__tabs() function and the panels-pane--tabs.tpl.php file (I assume was related to the "render pane" callback) just to say YEAH.

I checked out the bangpoundpanels.module file and found some theme registry hooks I suspected might help. By this point I'm implementing a heck more than I confidently intended to in Panels. Testing the theme hooks and pre-process functions in panels.module didn't seem to help and I may have been close, but alas, it's just beyond my understanding.

Would have liked to expand on this in a way similar to you, that others such as Merlin might appreciate, but it's going to take more capability to know what to do specifically.

In regards to patch #22
horizontal does not seem to work. No content shows up when I choose "horizontal". But it does show when I select vertical tabs

Undefined index: tabs_type in theme_panels_tabs_style_render_region (line 87 of panels/plugins/styles/tabs.inc

@SocialNicheGuru - I'll investigate this if I can reproduce it. What version of Panels, CTools, and Drupal are you using?

D 7.14
ctools 2012-Jul-18 http://ftp.drupal.org/files/projects/ctools-7.x-1.x-dev.tar.gz
panels 2012-Jul-09 http://ftp.drupal.org/files/projects/panels-7.x-3.x-dev.tar.gz

Edit:

Horizontal Tabs do not work. Nothing shows up in the page markup when looking at source
Noticed in the tabs.inc file that field_groups is needed. Is there anything I need to do to set that module up to create horizontal tabs?

Edit 2: Solution: Horizontal Tabs feature needs field_group 7.1 module
It in fact horizontal tabs do work. You need field_group 7.1.
field_group 7.2.x, which I was using, moves horizontal tabs to elements. Haven't tested if it works or not.

Undefined index is not an issue.
I enabled panels_tabs
set it as a pane style
disabled panels_tabs
uninstalled panels_tabs
applied your patch
cleared caches

the panes kept the tab style but needed me to go back and pick settings. Once I did that the "undefined index" issue went away.

Ah, yes! Thanks @SocialNicheGuru. You saw in the patch comments Field group is required to use horizontal tabs - this module defines their style, and the patch saves doubling up by just using this. I should have indicated this earlier. Have edited my post above. Thanks!

I believe this would be better served as its own module, where it can get more attention than I will be able to give it. As such I am unlikely to commit it to Panels, but I encourage someone (or a group of someones!) to create a module and get this feature available so people can use it.

Hey, this patch was working great but is broken with the latest release of panels (including the dev version). This would be a fantastic separate module. I've never maintained anything before but I suppose if I knew how to get this to work I will do what I can to have this developed as a standalone module. My first suggestion of course would be to find someone who knows what they are doing to maintain this or update the existing patch to work with the new version of panels. thanks!

like in 31, I updated panels and applied the patch. I get an ajax error now though.

EDIT: patch is fine
my issue was caused by pmfile from panels_media module. It caused an ajax error whenever I tried to select styles > change

EDIT 2:
could this patch be applied to
http://drupal.org/project/panels_tabs
http://drupal.org/project/panels_style_collapsible

How do I add a tab title for a content pane?

I added the ability to change content pane title but the change has no effect.

There is no title rendered for the tab. it is empty.

StatusFileSize
new3.73 KB

SocialNicheGuru, the attached file has Title support for views content panes.

in #30 merlinofchaos mentioned that it would be best to have this in its own module

there are two available which have not been updated in over a year. Would these fixes find a better home in these two modules?

http://drupal.org/project/panels_tabs
http://drupal.org/project/panels_style_collapsible