Node body weight ignored?
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior? Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
Just a thought, is content module (cck) coming through after your change and resetting it? Give your module a lower weight in the system table to test if something else is overriding your change.
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior?
The module's install file finds the highest weight in the system table and adds one to it, so it should be absolutely the last thing to run. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Lee Rowlands <leerowlands@rowlands-bcs.com> To: development@drupal.org Sent: Sun, June 6, 2010 9:45:32 PM Subject: Re: [development] Node body weight ignored? Just a thought, is content module (cck) coming through after your change and resetting it? Give your module a lower weight in the system table to test if something else is overriding your change.
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior?
We've all done it before - any chance your $node argument in the function definition is missing the &? One I'm always guilty of with form handlers when wondering why $form_state['rebuild'] = TRUE won't work or even better, I've called my function somemodule_nodeapi but the module's called someothermodule.
The module's install file finds the highest weight in the system table and adds one to it, so it should be absolutely the last thing to run.
Just a thought, is content module (cck) coming through after your change and resetting it? Give your module a lower weight in the system table to test if something else is overriding your change.
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior?
Well, considering that it's in a loop and all the other fields do move, that seems unlikely. I did not try the rebuild, but again, all th others do move; I assumed that hook_nodeapi(view) was too late in the process to rebuild. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Lee Rowlands We’ve all done it before – any chance your $node argument in the function definition is missing the &? One I’m always guilty of with form handlers when wondering why $form_state[‘rebuild’] = TRUE won’t work or even better, I’ve called my function somemodule_nodeapi but the module’s called someothermodule.
The module's install file finds the highest weight in the system table and adds one to it, so it should be absolutely the last thing to run.
Just a thought, is content module (cck) coming through after your change and resetting it? Give your module a lower weight in the system table to test if something else is overriding your change.
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior?
Have you tried simply dragging the field order around under Content Type >> Manage Fields? On 07/06/2010, at 1:01 PM, nan wich wrote:
The module's install file finds the highest weight in the system table and adds one to it, so it should be absolutely the last thing to run.
Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Lee Rowlands <leerowlands@rowlands-bcs.com> To: development@drupal.org Sent: Sun, June 6, 2010 9:45:32 PM Subject: Re: [development] Node body weight ignored?
Just a thought, is content module (cck) coming through after your change and resetting it? Give your module a lower weight in the system table to test if something else is overriding your change.
I have a hook_nodeapi op='view' implementation that is changing $node->content['body']['#weight']. Apparently it is being ignored because every other section that has a weight higher (less negative) than that weight is still being rendered above the body. I haven't yet gone digging through core to find out why this is happening. Is this the correct behavior?
Most of the $node->content sections do not appear in the CCK list because those modules don't make them available. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Chris Skene Have you tried simply dragging the field order around under Content Type >> Manage Fields?
Maybe hook_content_extra_fields might help shed some light but I'm clutching at straws here and if there's a heap of fields it might not be worth it. See http://www.lullabot.com/articles/great-pretender-making-your-data-act-field for a decent write up.
Most of the $node->content sections do not appear in the CCK list because those modules don't make them available.
Have you tried simply dragging the field order around under Content Type Manage Fields?
Well, you learn something new every day. Lee, you were close. CCK adds a #pre_render to the content, and that #pre_render code runs after mine and mucks with the weights. So now I have to refactor my code to do much the same after CCK is finished. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Lee Rowlands Maybe hook_content_extra_fields might help shed some light but I’m clutching at straws here and if there’s a heap of fields it might not be worth it. See http://www.lullabot.com/articles/great-pretender-making-your-data-act-field for a decent write up.
Most of the $node->content sections do not appear in the CCK list because those modules don't make them available.
Have you tried simply dragging the field order around under Content Type >> Manage Fields?
nan wich wrote:
Well, you learn something new every day. Lee, you were close. CCK adds a #pre_render to the content, and that #pre_render code runs after mine and mucks with the weights. So now I have to refactor my code to do much the same after CCK is finished.
When to fire the hooks is always evil. Consider changing the weight value in the system table for your module so that it executes after the CCK module. -- Earnie -- http://progw.com -- http://www.for-my-kids.com
Thanks, Earnie. As I mentioned earlier in the thread, my install code guarantees that I am the highest weight in the system table, so I will always have the last laugh, so to speak. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Earnie Boyd When to fire the hooks is always evil. Consider changing the weight value in the system table for your module so that it executes after the CCK module.
participants (4)
-
Chris Skene -
Earnie Boyd -
Lee Rowlands -
nan wich