Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
» Selecting a snippet breaks teaser splitter - need to rebuild body form field using node.module function
Ok - the site we created it for doesn't use the teaser splitter. I've a good idea what the issue is though. When the node body field is rebuilt after the AHAH submission we can't use the node module's function for building the body field, because drupal_render() puts it in an additional div and it breaks. I need to look at this more closely. Don't want to end up duplicating a node.module function. There must be a way to utilise it in this context so we don't break certain node behaviours.
Looked at this today. Unfortunately, using the node_body_field() function is not going to be trivial. I think some kind of a copy of it maybe needs to be implemented, but I hate that idea too. Yet to find an elegant solution to this, but I think it holds the key to a number of issues. I also tried building just for the textarea and drupal_render()ing that but it also failed, and as soon as you deviate from the node form's expected structure then your data is lost on save.
For now I'll have to leave this alone, but if someone has time to look at it over the next 4 weeks then that would be great. I'll be away, unfortunately.
Comments
Comment #1
greg.harveyOk - the site we created it for doesn't use the teaser splitter. I've a good idea what the issue is though. When the node body field is rebuilt after the AHAH submission we can't use the node module's function for building the body field, because drupal_render() puts it in an additional div and it breaks. I need to look at this more closely. Don't want to end up duplicating a node.module function. There must be a way to utilise it in this context so we don't break certain node behaviours.
Comment #2
greg.harveyLooked at this today. Unfortunately, using the node_body_field() function is not going to be trivial. I think some kind of a copy of it maybe needs to be implemented, but I hate that idea too. Yet to find an elegant solution to this, but I think it holds the key to a number of issues. I also tried building just for the textarea and drupal_render()ing that but it also failed, and as soon as you deviate from the node form's expected structure then your data is lost on save.
For now I'll have to leave this alone, but if someone has time to look at it over the next 4 weeks then that would be great. I'll be away, unfortunately.
Comment #3
greg.harveyReminding myself to test this is still the case, since it may have been fixed by #527622: WYSIWYG editors disappear after node body rebuild and switching filter does not bring them back