State machine: States as arguments
asciikewl - May 27, 2008 - 22:40
| Project: | Workflow-ng |
| Version: | 5.x-2.1 |
| Component: | State Machines |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
Description
I needed to build a view that takes the name of a state as an argument and does not seem to be supported, so I've written a patch to add it.
| Attachment | Size |
|---|---|
| states_views.inc_.diff | 1.44 KB |

#1
this functionality is essential. tested, and the patch works as advertised.
#2
great! But doesn't get this double escaped?
+ $where = db_escape_string($arg);
+ $query->add_where("node_state.state = '%s'", $arg);
I think so. Please correct me when I'm wrong.
#3
Being a bit of newbie at views, I modified that from views_node.inc line 503 that reads:
case 'filter':
$where = db_escape_string($arg);
$query->add_where("node.type = '%s'", $where);
break;
So looking at the code it should prob read:
$where = db_escape_string($arg);
$query->add_where("node_state.state = '%s'", $where);
or skip the db_escape_string part. Does add_where do escaping on the 2nd argument?
I'm a bit more worried about the 'link' case just after that as I haven't tested that much. (Not used in the site I'm building).
#4
although i'm certain there won't be a namespace issue in this case, shouldn't the function be named something like states_handler_argument_statement?
#5
ah, thanks aaron. Yes it should.
@add_where: Yes, as it's inserted via db_query() in %s.
@title: looking at other arguments, you should check_plain that.
#6
Where does this patch stand relative to the improvements since made to Rules?
#7
There won't be a states module for rules - as CCK + actions is the way go. So any possible improvements have to go into workflow-ng only.