Contemplate module and Drupal 7

Events happening in the community are now at Drupal community events on www.drupal.org.
dgtlmoon's picture

Hi All,

So I've picked up the contemplate module to maintain and help work on the D7 release.

ConTemplate provides a textarea per content type with a pre-generated output theme (similar to theme_field()) of all that content type's fields, there you can move them around / insert new stuff / change the layout completely.

It's used by newcomers because they can tweak the layout / HTML structure without putting files on the disk , as well as more experienced users for doing the same as well as tweaking the RSS layout etc.

However, thought I'de hit up you themers to see what your opinion is, theres a couple of hurdles for the D7 release, basically the main problem is that (as i can see) D7 does not load all rendered fields into the $node object, in D6, the contemplate textarea for managing your template would look like..

<div class="field field-type-filefield field-field-staff-pic">
  <h3 class="field-label">Staff Picture</h3>
  <div class="field-items">
      <div class="field-item"><?php print $node->field_staff_pic[0]['view'] ?></div>
  </div>
</div>

<div class="field field-type-other field-field-other-type">
  <h3 class="field-label">Other</h3>
  <div class="field-items">
      <div class="field-item"><?php print $node->field_other-type[0]['view'] ?></div>
  </div>
</div>

but the $node->field_other-type[0]['view'] (where you would expect to see the img src) is not present. And for many other fields (including the 'image' field) in D7, because Drupal now handles the rendering of the field content much later in the process.

I've thought of two solutions to this

1 - introduce a new variable called $content that has all this stuff rendered into it keyed by field name
2 - use the field tokens support in alpha4

thoughts? I hope i made my question clear..
So, the question is, what is the simplest/best way to present a textarea with a pre-generated output of the page that you can

Comments

Contemplate was written back

alexrayu's picture

Contemplate was written back in times, when template overrides were still weak. Now there are powerful template file overrides. So, we are not forced to store templates in code in database. With the new obstacle arising that you described, you might want to check out if this module is required enough to spend effort creating a workaround for that issue.

Contemplate is one of my

danny englander's picture

Contemplate is one of my favorite modules for Drupal 6 but when I recently tried it for Drupal 7, indeed it did not show the variables for my custom fields in the text area. I actually use Contemplate to copy the code and create a custom tpl file so it's kept in code and not in the database, perfect for theming. (In other words, I don't save it in the UI). I didn't have time to follow up and file an issue in the queue there but it looks like this is related: http://drupal.org/node/1109190

High Rock Media | Drupal Photography | Skype: highrockmedia | Twitter

Well it's a problem because

dgtlmoon's picture

Well it's a problem because in D7, those fields arent available in $node anymore (like the image field etc)

So i'm not sure how to fix this...

That's too bad-

twood's picture

Uggh- that's too bad. As a designer/themer coming over from D6 to D7, I am very used to getting code from this module and customizing content types with relative ease- Events, Home pages, etc. Any suggestions from some of you well seasoned D7 developer/themers on what/where to study/find to get beyond this module? I'm not afraid of stretching- I'd rather do things correctly within the framework.

Use the templting system

alexrayu's picture

Use the templating system. D7 templating system allows per-node and per-field even, templates. http://drupal.org/node/1089656

there is no other "contemplate"

drupalgambatte's picture

Hi;
Last few days I've been searching a userfriendly solution for display data in a vertical format, so that someone can easily enter data without messing the site,
tried many modules, eg. views, displaysuite, field collection, etc, along with supporting modules to display data in vertical -table- format,
Eventually, -only- contemplate was the candidate to give the desired result, but now I understand that it is no longer actively developed or maintained, which is sad,
because, it is a necessity for all cms -also for drupal- to have an interface which displays -and provides a means to edit- the code to get rendered,
For drupal, contemplate is the only chance!
All efforts to develope this module further will be highly appreciated,
Many thanks to the developers

yeah - I also feel abandonded

sonicthoughts's picture

As a non-developer, it was a treat, but even thought there is an rc.3 the issue list is really long and I'm afraid to depend on it. Yeah, you could just write a tpl, but for a non-developer that is intimidating.

Theme development

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: