Dear all,

I have my website up and running on Drupal, customized a lot, but the one thing I can't seem to get a grip on, is the recipe template... Is there anybody who is willing to show me their --node-recipe.tpl.php code? Or an basic example how to customize the recipe display on the front end. I have display suite, but that's not exactly what I'm looking for..

Thanks so much!!!!!

Comments

dcam’s picture

Priority: Major » Normal

There isn't any template. One thing that most people don't understand is that Recipe is a very old module, probably one of the first Drupal modules that was created. It has a lot of outdated code still in the 7.x-1.x branch. What controls the display of recipe nodes is the recipe_view() and various theme_* functions for the data fields in recipe.module. The HTML is output directly by those theme functions and it's probably been that way since before PHP templates were introduced to Drupal. I've overridden all that for a project once before. You can do it in a custom module using hook_node_view_alter() and theme function overrides. Or you could just hack Recipe's code. There's not likely to be any further development on the 7.x-1.x branch.

On the other hand, if you really are using the 7.x-2.x branch (which is the version shown on this issue) then it should be simpler. Most of the Recipe data has been converted to the more modern Field API. You should be able to control most of the node's display using one of the display modules that are available, e.g. Display Suite or Page Manager + Panels. I can't officially recommend this, however, since 7.x-2.x is a development version and isn't ready for use in a production environment. Sorry, there's no timetable for it's release.

rbroberts’s picture

Hmm, I have a site I'm managing for a local Boy Scout troop and we're putting up some recipes the scouts can use for camping trips. I can probably afford a certain amount of brokenness in the 7.x-2.x code, certainly cosmetics won't bother me.

The real question is whether or not use of the 7.x-1.x code is going to result in recipes that can't be upgraded to use the 7.x-2.x version with the field API, etc.

dcam’s picture

@rbroberts
Hello! I'm an Eagle Scout and am happy to help my fellow scouts. The answer to your question is that it should be upgradable from the 1.x to 2.x version. A tested upgrade path has been included in the 2.x version.

Unfortunately, I must admit that development of the 2.x version has stagnated. The project for which I was using Recipe at work was cancelled and my attention was turned elsewhere. I do plan to get back to it, but so far it hasn't happened.

As for which version is more broken, that's a matter of perspective. The 1.x version uses old data storage practices that the majority of the Drupal community would balk at supporting these days. It also does a lot of strange things that I wish I could just throw out of the 2.x version. You can't change the text filtering on any of the fields. The data is also incompatible with nearly every other contrib module that expects data to be in the Field API, e.g. Panels or Search API. Most people these days would consider those major drawbacks to be very broken.

On the other hand, the 2.x version has had some genuine "brokenness". At least one major bug was discovered by someone after I migrated a field a while back. Still, 2.x uses the more modern Field API to store nearly all of the recipe data. In theory, that should make that data a little more bulletproof. Plus, the data should be accessible to other contrib modules.

I think the major reasons why I would recommend against using the 2.x branch were:

1. The possibilty of bugs.
2. The possibility of design changes that could remove functionality that you're using. Like I said, I wish I could stop the module from doing a lot of what it currently does.
3. On-going changes to the recipe data storage.

I think #3 is probably the most serious potential problem since it could result in data loss. I think that the upgrade path will keep your data intact when updating from a 2.x version to a later 2.x version, but I can't make a guarantee. Of course, that may not be a big deal because I think there's only one more field to migrate.

That's all I can think of to tell you. I hope that helps you make your decision. Good luck to you.

rbroberts’s picture

Thanks. I've created only one recipe so far as a test. I may give 2.x a shot.

dcam’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.