Hi guys,

I don't think anyone else has specifically asked for anything like this, but it would be great to have a drupal_alter for $node_diffs so that it's possible for to remove any unwanted fields?
Use case is WYSIYWG ImageField, as the ImageField is irrelevant (and mostly hidden) a comparison is wasteful.

No patch as it's a one line change:

Add the following line after the module_invoke call on line #340 of diff.module:

  drupal_alter('node_diffs', $node_diffs, $old_node, $new_node);

Cheers,
Deciphered.

Comments

realityloop’s picture

Status: Needs review » Postponed (maintainer needs more info)

Keen to add this, but there is no line #340 in current dev

alan d.’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Postponed (maintainer needs more info) » Needs review

@realityloop
I'm going to push through a number of minor patches that should go in before the big patch. This will make it easier to backport these to Drupal 6 and provide better tracking.

Looking forward, the Drupal 7 patch introduces the diff.api.php file that hints at the upcoming changes and warns users that hook_diff() is depreciated. The actual alter is:

+  // Allow other modules to interact directly with the results.
+  $context = array(
+    'old_entity' => $old_node,
+    'new_entity' => $new_node,
+    'entity_type' => 'node',
+  );
+  drupal_alter('entity_diff', $node_diffs, $context);

And Drupal 6 is just:

+  // Allow other modules to interact directly with the results.
+  drupal_alter('node_diffs', $node_diffs, $old_node, $new_node, $remove_markup);
alan d.’s picture

I wish I had a dollar for every time that I save before attaching the patches :)

alan d.’s picture

To give commit credit (and thus someone to blame if things go wrong) the following format can be used:

D7
git commit --author="aland <aland@198838.no-reply.drupal.org>" -m="Issue 888680 by Deciphered, Alan D.: Allow modules to interact via drupal_alter()"

D6
git commit --author="deciphered <deciphered@103796.no-reply.drupal.org>" -m="Issue 888680 by Deciphered, Alan D.: Allow modules to interact via drupal_alter()"

Usage
Apply patch
git add -A
The commit
(repeat for other patches on branch)
Push

The author gets the commit authorship once pushed but I'm not sure what the other user roles get. My policy is to push through individual commits accrediting the code writer, and note users that have interacted in a significant way in the commit - aka users that reported the bug, testers, reviewers, etc. Though sometimes I do use "John Doe, et al:" if there are many.

No-one seems to use format-patch :(

Anyway, it is a nice way of tracking users through the system and I think that if more maintainers use this, it should spark more interest in non-maintainers to actually write patches

deciphered’s picture

Alan, I was specifically told not to use it by core developers, which is disappointing as I recall them making a a huge deal about people getting the appropriate attributions for their patches, but none of my core patches where attributed to me :|

Ah well, it's not about the individual, it's about the project.

Patches look good, I'll give them a quick test this afternoon, but I don't see any reason they can't be RTBC.

alan d.’s picture

Core is different, it never happens.

http://drupal.org/node/38878/committers is a great example why to

deciphered’s picture

I'm all for it, and I work with Realityloop so I can assure you he will be too.

alan d.’s picture

Cool, I may have to get you to get your project manager to free some time contrib time for Brain to push some things through :)

tim.plunkett’s picture

Issue tags: +Needs backport to D6

Fixing tags

alan d.’s picture

Version: 7.x-2.x-dev » 7.x-3.0-alpha1
Status: Needs review » Fixed

This should be resolved with the new branch, 7.x-3.0-alpha1 or 7.x-3.0-dev.

alan d.’s picture

Version: 7.x-3.0-alpha1 » 6.x-2.x-dev
Status: Fixed » Needs work

Actually, this can be backported if I find the time :)

mitchell’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs work » Fixed

This is fixed in 7.x-3.x. Backport requests should be made in separate issues, if absolutely necessary.

Status: Fixed » Closed (fixed)
Issue tags: -Needs backport to D6

Automatically closed -- issue fixed for 2 weeks with no activity.