It would be a nice feature if somewhere in the panels settings you could specify what the default style would be when adding new panes.

For instance we are creating a website right now that almost all of the panes are use the "System Block" style to match the styling normal system blocks get. This means that each time a pane is added you have to remember to go in to the style for that pane and choose the "System Block" style which is a bit of a pain.

You also cannot choose styles in the IPE which means we cant really use the IPE. Each new pane you would add through it you would then have to go into the panel content and manually change the pane style, which makes the IPE not so useful for adding panes, though it is handy for editing them quickly.


merlinofchaos’s picture

Yeah, I can see this being a useful option.

kant’s picture

Me too. Subscribing...

heylookalive’s picture


z1pzap’s picture


Johan den Hollander’s picture

Subscribing. This would be a nice feature to have. There are quite a few people who can create new content in my sites panes. They need to be instructed now to use the right style.

A possible workaround could be to switch the default style to the desired style although I did not try that myself.

karljohann’s picture

Has there been any progress on this?

clashar’s picture

Letharion’s picture

Assigned:Unassigned» merlinofchaos
Status:Active» Needs review
new1.56 KB

The patch is in no way ready, but I would appreciate if you could take a look at it.
1) Where should the select box be?
2) Where should I be setting the default? I can't seem to reach the configuration from the function where I do it now?
3) Other things?

codewatson’s picture

I imagine that the place to have the configuration would be on the /admin/build/panels/settings page or the sub pages of that so that each type (page, mini, panel node) could have it's own custom setting?

Bugger if i can find where those forms are built, panels and ctools seem so integrated its hard to tell which one controls what, had to stop looking before my head exploded.

merlinofchaos is there any direction you can give us for figuring this out?

Old Account’s picture

This would be an awesome feature.

FilipNest’s picture

Has anyone had any luck with this since #8?

I've made two custom style plugins, one with a select list for choosing from a list of CSS classes and another with just a CSS class text-field input and would love if I could disable the other ones (aside from the default no style). That way I could style the no style option and give a site-specific selection of styles for editors to choose from. It took me a while to get my head around writing the style plugins (I used to just add classes through the panels admin section) but now that I know how I realise it's a fantastic feature for quick styling, especially through the in place editor.

The ideal situation would not only be an interface for enabling and disabling styles in the admin but a system where you could use roles and context to choose which styles were available. That way the in place editor could allow different styles on different pages and for different users which would be an amazing feature.

merlinofchaos’s picture

Okay, to do it right there probably needs to be something that is passed into the display during edit mode so that the editor can figure out proper defaults. Kind of like the setting as to whether or not there should be a display title. Then, individual apps can pass that in.

You also need to not only select a default style, but if it has config, have a form for that config.

For the panel context, which is the logical first benefactor of this functionality, the page for this should probably be somewhere hear the available content page.

Letharion’s picture

Assigned:merlinofchaos» Letharion
Status:Needs review» Needs work

Moving back to myself for work.

superjerms’s picture

Any progress on this?

Just a thought, what if new panes just inherited whatever style you set to its parent container?

clashar’s picture

And also any progress on D7?

dv8withn8’s picture

This is a pretty important feature to have. Has anyone attempted it in the 3 years this request has been open?

emattias’s picture

Version:6.x-3.x-dev» 7.x-3.x-dev

I aim to have this feature in Semantic Panels but there is no hook (to my knowledge..) that can be used to set styling on new panes.

I created a patch that adds the drupal_alter I need. See #1985980: Allow altering of new panes

This would be a solution to atleast allow other modules to provide this feature.

I hope it was ok to change this to 7.x?

caschbre’s picture

@emattias... how do you envision setting a different default style after adding #1985980: Allow altering of new panes ?

Edit: figured it out

function MODULE_panels_new_pane_alter(&$pane) {
  $pane->styles['style'] = 'my-widget-style';
caschbre’s picture

What I need to figure out now is that my-widget-style also has a settings form. Any suggestions no how to kick that off for new panes?

michaelmol’s picture


In D7 this should be:

function MODULE_panels_new_pane_alter(&$pane) {
  $pane->style['style'] = 'my-widget-style';
thtas’s picture

Issue summary:View changes

Here is my code for this which doesn't require any patches:

 * Implements hook_form_alter
function MYMODULE_form_alter($form, &$form_state, $form_id) {
  if(preg_match('/_content_type_edit_form$/', $form_id)) {
    $pane = &$form_state['pane'];
    if($pane->pid == "new") {
      $pane->style = array(
        'style' => 'STYLE',   //default style name  
        'settings' => array(
         /*default style settings here*/
Chris Gillis’s picture

Chris Gillis’s picture

Now that #1985980: Allow altering of new panes has been committed, it would be awesome to turn #20 into a UI setting.

mrjmd’s picture

new1.67 KB

I took a look at this, but the problems mentioned in #8 still need to be answered. Specifically, how to get at the panel variant configuration from within panels_new_pane() or panels_panels_new_pane_alter(). My work-in-progress patch is attached, which allows saving of a default but does not actually apply it to new panels yet.

Albert Volkman’s picture

Over in #2030075: Add a UI to allow someone to set default block, panel, pane settings we were discussing how this would be handy to be available for Panels and Region defaults as well. In my instance, the less user interaction required at this level, the better.

codewatson’s picture

Would it not be easier to have a global option to set what the default is, then whenever a new panel pane is added, part of the workflow of creating a new pane (no matter what type it is) would be to bring up the pane style configuration form?

Albert Volkman’s picture

Looking at the patch in #24, the main issue with using hook_panels_new_pane_alter() is that the passed in $pane object does not have a display context (did is blank). Unless we change what gets passed into panels_new_pane(), or add another alter within panels_renderer_editor::ajax_add_pane().

However, if we go the route of creating a single administration section with defaults per pane type/subtype, then that should be feasible.