When a composite-based node has a noderef field which references another node, and this node is being deleted, composite node keeps track of this "empty field" in zones form...
Here is a patch which deals with this situation the same way than proposed in #765666: Node deleted display empty lines in composite form.

Comments

bengtan’s picture

Hi,

A couple of quibbles.

I think the warning should only be emitted if the user is privileged in some way (ie. an account who can edit the node), otherwise anonymous visitors to your site will see the message.

Secondly, the testing for deleted node references is cleaner if done during the node view and/or node form (for editing) rather than the node load (of the 'parent' composite-enabled node).

Otherwise, I think the idea has merit so you're welcome to push it further.

raphael waeselynck’s picture

Hi,
I totally agree concerning the warning (I will submit a patch soon) only emited for privileged users.
But I disagree on the second point.
First, the warning should appear not only on the node edit form, indeed the zone form is also concerned... Since composite_load is called on the load operation of the composite_nodeapi hook, we are guaranteed that we will test the presence of a broken nodereference whatever the form we want to see. And Anyway, it is not so bad that a privileged user can see there is a broken noderef when viewing a node.
Secondly, even in a form_alter we should check every composite references...Since in composite_load we load every composite references one by one, we can meanwhile test if this reference is a broken one.

bengtan’s picture

Hi,

Just looking at your patch a second time ... you're actually talking about deleted nodes referenced by CCK Nodereference fields (originally, I thought you were talking about nodes included through Composite's Nodes tab).

That changes things a bit.

The parts of the code which are dependent on CCK should be moved to the composite_cck submodule. Checking for deleted nodereferences should be done there. The main module composite.module should not require CCK to be enabled.

Secondly, I think it would be a good idea to consider following what CCK/Nodereference does when nodes referenced by Nodereference are deleted:

The deleted node does not show in the node view of the parent node (since there is nothing to show). The node edit form (and also the Zones form, by corollary), indicates the referenced node is missing, so the user has a choice to delete the nodereference. I'm not sure if we really need a warning (as a Drupal message) if the node edit is clear enough.

Bringing this idea further ... this issue of deleted nodereferences isn't really a Composite issue. It's an issue with CCK/Nodereference itself and should be dealt with there. I'm having second thoughts about whether Composite should try to do anything about it.

raphael waeselynck’s picture

Ok, I understand your point of view.
Unfortunately I do not have the time to deal with this issue further, so at least I prefer to contribute my patch, it may help someone who will try to solve this issue later...

bengtan’s picture

Status: Active » Closed (won't fix)

Expiring this issue as it is old and uncertain whether it is still applicable.