I created a new action on a new node being created, it shows up in my triggers and the action gets triggered. Works so far. Problem is trying to add additional functionality using some submitted field values. As of now, all its doing is logging in Watchdog. My goal is to be able to set a flag on the node based on certain values.
------------------------------------------------------------------
/**
* Implementation of hook_action_info().
*/
function my_custom_action_info() {
return array(
'my_custom_action' => array(
'type' => 'node',
'bundles' => array('article'),
'label' => t('Check article for stuff'),
'configurable' => FALSE,
'triggers' => array('node_insert'),
),
);
}
function my_custom_action($node) {
$myvar = $node->nid;
my_custom($myvar);
}
function my_custom($myvar) {
watchdog('Test', 'My Custom Variable: ' . $myvar);
}
--------------------------------------------------------------------------
If I set the variable to an integer or text, it works. But how to get any value from the submitted node? Eventually I'd like to get a value from a specific field, but for now just testing with the Node ID and can't seem to get it.
The error I'm getting is : "Notice: Trying to get property of non-object in my_custom_action() ... "
This part: $myvar = $node->nid;