3

new to Drupal 7. I can kind of get the result I want through "hacky" methods but was wondering what best practice was.

I am creating a drupal 7 bootstrap subtheme.

The main content area of the site needs to come in two basic verities.

  • A single column content area
  • A two column content area

I want my end users to be able to select which of the two page layouts to use should they need to create a new page.

I can create the effect to some extent by having the two areas defined as regions in my theme and then having them populated - or not - with blocks. The issue with this solution is I don't want my end users to be able to add blocks to both layouts. I want them to be forced to select one or the other.

is there an accepted "drupal" way to do something like this?

1 Answer 1

3

Option 1:

The simplest "core" way to do this, is to create two separate content types. For this example, let's call one One Column and the other Two Column

You can now create two different node template files:

node--one-column.tpl.php
node--two-column.tpl.php

Now you can customize those two template files to display the content however you wish, and it would depend on what you want to accomplish with each of these.

Option 1a:

If you decide to go with option 1, using Paragraphs to allow your users to add multiple fields into the columns could be well suited to your needs.

Option 2:

Another option is to use Display Suite which has the similar idea of creating multiple template files, but here you can choose the display method on a per node basis (via Display Suite Extras) Also since you are using Bootstrap, there is a nice add-on called Display Suite Bootstrap Layouts that provides layouts for you to use.

Option 3:

Panalizer allows you to use "Panels" on a per node basis, which could help you solve this problem. There is also a Panels Bootstrap Layouts module as an add-on.

Option 4:

I believe Panopoly can do this as well.

Summary:

There are many different ways to do this, but you will have to try them out to see which works best for you. The options above are probably the most common so I'd start there. If you need anything more specific for your needs, there is always a way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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