Closed (fixed)
Project:
Panels
Version:
7.x-3.0-alpha3
Component:
Plugins - styles
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Jun 2011 at 18:52 UTC
Updated:
28 Sep 2011 at 23:10 UTC
I love the styles plugin, and I've been using it to create custom panel pane and region styles, but I am trying to include a settings form for a style, and I'm afraid I can't get it to work for reasons I don't understand.
I've created an include file for my new style which is getting picked up. Everything works except the settings form doesn't appear. Is it possible to define a style settings form within a theme? If so, could you let me know what I'm doing incorrectly?
Thank you!
$plugin = array(
'title' => t('Collapsible'),
'description' => t('Display a pane that may be collapsed.'),
'render pane' => 'innovate_collapsible_style_render_pane',
'settings form' => 'innovate_collapsible_settings_form',
);
function theme_innovate_collapsible_style_render_pane($vars) {
//Formatting
}
function innovate_collapsible_settings_form($style_settings) {
$form = array();
$form['pane_collapsed'] = array(
'#type' => 'checkbox',
'#title' => t('Collapsed by default'),
'#default_value' => (isset($style_settings['pane_collapsed'])) ? $style_settings['pane_collapsed'] : FALSE
);
return $form;
}
Comments
Comment #1
merlinofchaos commentedStyles evolved in kind of a clunky way. I believe you need 'pane settings form' -- 'settings form' goes to regions.
Comment #2
jastraat commentedYes! That was exactly the problem. Thank you!
Comment #3
jastraat commentedComment #4
mistermastermatt commentedHello, I was very excited when I found this post as collapsible panes is exactly what I'm after (for 7.x) but I'm afraid I'm still pretty new to Drupal and don't know how to implement what you've described. Is it possible you (or anyone) could give a more step by step guide? I appreciate it's probably a tall request, but I thought I'd ask.
Many thanks.
Comment #6
jastraat commentedSo, this is an example of implementing a panels style - specifically on an individual pane vs. a region. I'm just using the existing ctools theme function to generate the classes.
To add panels styles through your theme, you need to add a line to your theme .info file:
plugins[panels][styles] = panels/styles
'panels/styles' should be the path to the directory where you put your style include files.
I created an include file called 'collapsible.inc' in the directory as named above.
Example code:
'innovate' is my theme name, so you would replace that with whatever your theme name is.
Comment #7
mistermastermatt commentedThank you very much, I really appreciate you taking the time to help me out. Worked like a charm.