Implement hook_content_extra_fields() so CCK can re-order our message
| Project: | Active Translation |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi,
I have issues with Active Translation on some sites of mines : the message is displayed below the node content, and not above. As you can imagine, having a notification displayed at the bottom of a node isn't very useful ^^
A strange thing is that the message is displayed at the bottom on some sites, and correctly, at the top, on others, while they are using the same theme and same module versions... Either way, I tracked the issue down to this (line 102):
$node->content['language'] = array(
'#type' => 'item',
'#title' => t('Translation Note'),
'#value' => $message,
'#theme' => 'active_translation_node_message',
'#weight' => -100,
);Seems like the weight parameter isn't taken into account, since I can put whatever value and it won't change its order. Instead it seems to follow alphabetical order since it goes at the top if I edit the first line to something like:
$node->content['aaalanguage'] = array(
Wouldn't it be better to use drupal_set_message() to put the notification into $message instead of $content? This way it would be possible to theme more easily.
Thanks!

#1
Found, after closer examination of rendered array! And the culprit is... CCK, and its function content_alter_extra_weights() which alters default weights for the content.
To fix, just go to admin/content/node-type/[type]/fields, make sure that "Language" is above "Body", et voilà, Active Translation message is displayed before the node content. It should be documented somewhere...
#2
Actually I think we should implement hook_content_extra_fields() so that you could re-order the message as you see fit.