3

I am trying this for long time. I am trying to add additional class in panels region. I am using panel page to display one of my node. I want to add region class but I am not getting success. Is there any way to achieve this? Is it possible to rewrite layout template in my theme? If so I can achieve this quickly. For example I wonder if it is possible to override layout template based on my node content type.

Thanks a lot.

1

You can create custom layouts in your theme for panels, there's a fairly good how to guide here: https://drupal.org/node/495654

If you wanted to use different layouts for different nodes, you can add a variant to your panel pages, and under "selection rules, select "node:type" and select the content type you want. Then you can assign different panels layouts to each respective variant under the layout tab.

  • You can also use the Panelizer module to easily change layouts and other Panels settings on a per node basis. – dcmouyard Sep 25 '13 at 21:32
1

If you just want to change the markup and classes of Panel regions and panes without changing the entire layout, check out the following modules:

  • Clean Markup

    This module aims to clean up, enhance and facilitate the customization of markup for Drupal core and several popular contrib modules such as Panels.

  • Semantic Panels

    It's a CTools style plugin that gives you full control over the HTML output of Panels panes. With it you can individually add/remove the:

    • Html element
    • Classes
    • Other attributes

    On the pane title, pane content, and pane wrapper.

1

I came across the same problem this morning, and after some googling found an answer. It comes down to finding the right tpl.php file and copying it to your own theme.

If you're subtheming from a base theme (in my case, for example, adaptivetheme), the base theme may provide its own layouts. Template files will be included there. The base theme may also implement a template_preprocess function that you can use to add classes, if that's supported within the .tpl.php.

Panels ships with some built-in layouts. I think that the template files located in the panels module directory under plugins/layouts/<layout>/panels_<layout>.tpl.php will be what your're looking for. I haven't used them specifically, but they appear to follow the same pattern.

If you want to provide a different layout depending on node content type, however, you'd probably want to explore using panels page variants in the node_view panels page. You can change layout and add pane-specific classes there through the UI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.