Fasttoggle is a powerful tool for toggling not only built-in object properties (e.g., user status) but also custom properties. However, due to limitations in comment module, at present we can't add toggleable properties to comments like we can to nodes and users.

Specifically, I'm trying to add a custom toggleable property, http://drupal.org/node/226836, so that users can block content by the author of a comment. But I have no way to add a property to a comment. While nodes and users support API 'load' ops and therefore custom properties, comments by default do not. In e.g., in fasttoggle_link() we test for a changed property, but if we can't set the property in the first place we can't test if it's changed. We're limited to the fields in the comments table (_comment_load() is a single-table SQL select query.)

The attached patch (on HEAD, but should apply to 6.x and 5.x) adds support for a hook_comment() 'load' op, which would enable custom toggleable properties for comments.

(This is a bit like we've already done with user links. The user module doesn't call hook_link() by default, so we've added an implementation.)

CommentFileSizeAuthor
fasttoggle-comment-load.patch2.06 KBnedjo

Comments

yngens’s picture

Tried to apply against 5.x.-1.x.dev and it gave an error:

 patch <*patch
patching file fasttoggle.module
Hunk #1 succeeded at 236 (offset 104 lines).
can't find file to patch at input line 46
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: fasttoggle.toggle.inc
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/fasttoggle/fasttoggle.toggle.inc,v
|retrieving revision 1.1
|diff -u -r1.1 fasttoggle.toggle.inc
|--- fasttoggle.toggle.inc      7 Oct 2007 12:44:04 -0000       1.1
|+++ fasttoggle.toggle.inc      27 Feb 2008 17:57:35 -0000
--------------------------
File to patch: 
yngens’s picture

applying to 5.x.-1.0 has given:

 patch <*patch
can't find file to patch at input line 8
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: fasttoggle.module
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/fasttoggle/fasttoggle.module,v
|retrieving revision 1.9
|diff -u -r1.9 fasttoggle.module
|--- fasttoggle.module  26 Feb 2008 22:20:35 -0000      1.9
|+++ fasttoggle.module  27 Feb 2008 17:54:13 -0000
--------------------------
nedjo’s picture

The patch is against HEAD. It would need adapting for 5.x.

kkaefer’s picture

Status: Needs review » Fixed

Thanks, looks good. I committed it to HEAD. Let me know whether it solves your problem. If it does, I'll release a new version.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

melkinny360’s picture

Hi,
By Peter deHaan On September 27, 2010 · Leave a Comment ... Creating a custom label function on a Spark ButtonBar control in Flex 4 ... button labels on an MX ButtonBar control in Flex by setting the labelFunction property.
...............
Sunshine Coast real estate

  • Commit 57f59a2 on 6.x-1.x, master by kkaefer:
    - Fix URLs in help texts - #227582 by nedjo: Allow modules to change the...

  • Commit e1973da on master, 7.x-1.x by kkaefer:
    #227582 by nedjo: Allow modules to change the comment object