hooks for add/remove

yched - January 21, 2008 - 12:09
Project:Nodequeue
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

It would be useful to have a hook fired when nodes are added / removed from queues.

#1

merlinofchaos - January 21, 2008 - 17:00

This should be pretty easy. Patches welcome! =)

#2

baldwinlouie - September 11, 2008 - 05:01

+1

#3

baldwinlouie - September 11, 2008 - 17:40
Status:active» needs review

I am also needing a hook after a node is added/removed from a queue. Here is a quick patch I created with those hooks. Please review and feedback is appreciated. This is rolled against 5.x-2.2 branch.

AttachmentSize
nodequeue-212510-3.patch 1.21 KB

#4

ezra-g - December 23, 2008 - 19:44
Version:5.x-2.x-dev» 6.x-2.x-dev

Bumping to 6.x. This would be a good feature.

#5

ezra-g - December 27, 2008 - 01:11
Status:needs review» needs work

Thanks for the patch!

This looks good but the hook definitions should follow the naming convention nodequeue_api_...

#6

baldwinlouie - December 29, 2008 - 19:10

I rerolled it with the naming convention suggested.

AttachmentSize
nodequeue_212510_4.patch 685 bytes

#7

ezra-g - December 31, 2008 - 05:35
Status:needs work» needs review

Updating status. I hope to test this soon.

#8

ezra-g - April 30, 2009 - 23:50
Status:needs review» needs work

Sorry about the delay in reviewing this. I was hoping to get it into the upcoming release, but it currently applies by putting the new code inside of the comments of an existing function definition :-&. Could you reroll with the diff -up option? This is why -up is listed as a best practice for creating patches ;)

#9

baldwinlouie - May 1, 2009 - 05:21

@ezra-g

Here is a re-roll with -up option. The patch is currently for the D5 branch. Let me know if you want a roll for the D6 branch as well.

AttachmentSize
nodequeue_212510_5.patch 1.23 KB

#10

baldwinlouie - May 1, 2009 - 05:37

@ezra-g, one more re-roll. I realized my local copy of nodequeue was not the D5 dev branch. This re-roll uses the D5 dev branch.

AttachmentSize
nodequeue_212510_6.patch 1.3 KB

#11

Scott Reynolds - May 1, 2009 - 16:19

May i suggest this be one hook not two. hook_nodequeue_api($op, $subqueue, $nid). Where $op would be 'add' or 'remove'. Also, no need for the for loops. just do module_invoke_all('nodequeue_api', 'add', $subqueue, $nid)

#12

daniboy - May 6, 2009 - 10:08

I agree with Scott, using a single hook similar to how hook_nodeapi() works would prevent the API from becoming too big and hopefully help in making this more extensible in the future (A quick idea off the top of my head - add another hook call with $op = "pre add" so that other modules can allow or disallow adding a node to a subqueue)

#13

baldwinlouie - May 7, 2009 - 00:03

points taken....I'll reroll with those suggestions.

#14

Dave Reid - August 6, 2009 - 17:43

Keep in mind with Drupal 7 we are eliminating the all-encompassing hook_something_api($op) type hooks in favor of splitting them out. Maybe we should keep the hook separate and make it easier to upgrade modules to Drupal 7?

#15

cyberswat - August 6, 2009 - 18:12

Here's another attempt at a patch.

AttachmentSize
nodequeue_212510_7.patch 1.96 KB

#16

ezra-g - August 8, 2009 - 16:38
Status:needs work» needs review

Marking as needs review.

#17

Rob Loach - August 19, 2009 - 21:57

Don't think hook_nodequeue_swap would be used at all, but I can see why add/remove would be nice. Here's an updated patch with some more documentation.

AttachmentSize
nodequeue_api.patch 2.46 KB

#18

cyberswat - August 20, 2009 - 13:13

In our systems we use a custom type of caching that stores the output of pages. The swap hook is used to notify when delta's have changed so that we can rebuild that part of the cache. I think it's a pretty important item to have in place.

#19

Rob Loach - August 20, 2009 - 14:48

Ah, then making sure you get notified when the position has switches is important ;-) .

#20

cyberswat - August 20, 2009 - 15:44

This patch builds on what was done in #17 by adding hook_nodequeue_swap back in with documentation

AttachmentSize
nodequeue-212510_9.patch 3.25 KB

#21

ezra-g - August 27, 2009 - 20:31
Status:needs review» fixed

This is committed, minus the nodequeue.api.php. We already have a readme file and a documentation page on drupal.org. @Cyberswat: Could you update the documentation page with these new functions please :)?

Thanks!

#22

DamienMcKenna - August 28, 2009 - 14:22

Thanks for the work on this, am looking forward to the next version :)

#23

cyberswat - August 28, 2009 - 15:34

@ezra-g: I added a Nodequeue API section to the documentation page. I seriously suck at documentation so feel free to revise :) Thanks for getting these hooks committed.

#24

Dave Reid - August 28, 2009 - 20:52

+1 for nodequeue.api.php. It's the new standard for documenting hooks.

#25

System Message - September 11, 2009 - 21:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.