Other modules' addition to the body or teaser gets lost...
ednique - November 9, 2006 - 22:59
| Project: | Content Templates (Contemplate) |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
Premium alters the body and sets the teaser as the body + adds a message asking to log in
Nodevote adds the voting restults to the teaser...
Nodevote adds the voting results + voting form to the body...
All those additions get lost when using contemplate...
The hook_nodeapi() of contemplate should be executed BEFORE all other modules using this hook...
But is that possible?

#1
Same applies when you mark a CCK content type as being an event...
Event dates get lost...
After investigation I figured out that the contemplate_nodeapi() is causing this issue...
A lot of other modules using the hook_nodeapi() are executed before the contemplate code and all get lost...
It may be better to use the hook_view() instead, just like cck does...
I changed a few lines of code and seems to work...
Once tests are completed, I post my solution.
#2
Here's my solution...
It needs a little change in the CCK module. You should ask them to add the code, or ask them to provide a hook that you can call.
if (module_exist('contemplate')) {contemplate_view($node);
}
Next the contemplate module needs that function + a slight change in the content_nodeapi so that it is only executed for content types that are NOT CCK...
here's the CCK patch
#3
And here's the Contemplate patch
#4
Is this patch the right solution? Can it be committed? I'm having trouble using CCK nodes as Organic Group home pages. Contemplate prevents any of the group nodes from showing on the homepage. Once I disable contemplate, there they are, but the format looks awful.
#5
same problem here.
the patch worked with 4.7, but not in 5.0.
#6
The content module patch does not apply to the most recent release of CCK. Can the patch be updated to work with the newer release?
#7
FWIW it also seems any editing to the Contemplate teaser field causes other modules content to be skipped. For instance, if I hit "reset" when editing my Contemplate template, the buttons for Service Links module show up on my CCK nodes fine. But if I do any manual editing to the teaser area of that same Contemplate template-- like even put in a single extra carriage return or whatever-- the Service Links buttons are then stripped when viewing the node. Hitting "reset" when editing the Contemplate template will then show them again (but that means I can't touch the template once Contemplate creates it).
#8
I suppose I should clarify my earlier statement that the content.module.patch does not work. I have tested it with the current 4.7.1-x developement and 4.7.3-release versions of CCK. In both cases the patch fails. The contemplate patch, however, seemed to work, unfortunately, the patched contemplate module no longer has any effect on the appearance of the CCK node
#9
First off, I stopped using contemplate as the latest CCK allows you to alter the teaser and body inside the CCK code...
to help you out, I checked the changes again...
The patches first of all are for 4.7.x version...
for the content.module you have to locate the function content_view in that function you will find:
$node->body = implode('', _content_field_view($node, FALSE, $page));$node->teaser = implode('', _content_field_view($node, TRUE, $page));
$node->readmore = (strlen($node->teaser) < strlen($node->body));
change it to
$node->body = implode('', _content_field_view($node, FALSE, $page));$node->teaser = implode('', _content_field_view($node, TRUE, $page));
if (module_exist('contemplate')) {
contemplate_view($node);
}
$node->readmore = (strlen($node->teaser) < strlen($node->body));
This code makes it so that contemplate is called from the CCK...
Next you need to change the contemplate module so that its normal processing is done for NON-CCK content types and the function contemplate_view needs to be added.
see attached patch...
I hope this will help...
#10
Your solution is perfectly working with Drupal 4.7.x and I try to adapt it for Drupal 5.x. Up to now, I have not succeeded as the alter/view mechanism seems to have changed a bit but I will post here a solution once I have one. Any hint or help is, of course, welcome...
#11
Why hasn't this patch been included for both projects? I am trying to bring some attention to this issue with this thread:
http://drupal.org/node/162042
#12
#13
Any work on a fix for this issue on CCK 6? This problem may not prevent the module from being used, but it does make it much more difficult to use with book pages, etc. where other modules should be automatically adding links or content to a node.
#14
No CCK will not call contemplate directly... ever!