Here's my code to start with:
function finance_views_arguments()
{
$arguments = array(
'Finance: to_or_from' => array(
"name" => "Finance: Transfers to or from node",
"help" => "Displays just transfers that are to or from the current node",
"handler" => "finance_handler_arg_to_or_from",
),
);
return $arguments;
}
And my handler:
function finance_handler_arg_to_or_from($op, &$query, $a1, $a2)
{
if ($op == "summary")
{
$query->add_field("from");
$query->add_groupby("node_transfer.from");
$fieldinfo['field'] = "node_transfer.from";
return $fieldinfo;
}
if ($op = "filter")
{
// $query->add_where("node_transfer.field_from_nid = '$arg'"); //<<<<THIS LINE BREAKS
$query->add_where("n.type = '$arg'"); //<<<<THIS LINE BREAKS
}
if ($op = "link")
{
return l('todo','#');
}
if ($op = "title")
{
return $query;
}
}
when I display the view with my argument code in it says
Fatal error: Call to a member function add_where() on a non-object in /home/...blah.../mymodule.module on line 292 [commented above]
I've been using and reading http://drupal.org/node/42609 and http://drupal.org/node/99566 to make this code. For example, I copied the code from one of the examples exactly, to see if I could get it to work:
<?php