Posted by drupalprojects on January 14, 2016 at 12:59pm
Hi
I have posted this in issue queue, but it got no attention, so try to get an answer here.
In my module I implement hook_rules_action_info few parameters including node and user.
It works, but only allows me to select from current logged in user on the action configuration screen. I want to be able to specify username and get a list of users to choose from. Same for the node - autocomplete only allows me to choose from current node while I want to see node autocomplete field where I can start typing node title and then select from list.
Is it possible? If yes - how to do that?
Here is my code:
<?php
/**
* nodegift_rules_action_info - implementation of hook_rules_action_info
*
* @access public
* @return array
*/
function nodegift_rules_action_info() {
$names = node_type_get_names();
$giftContentTypes = array();
foreach ($names as $key => $name) {
if (nodegift_is_gift_type($key)) {
$giftContentTypes[] = $key;
}
}
return array(
'send_gift_to' => array(
'label' => t('Send gift'),
'group' => t('Node Gift'),
'base' => 'nodegift_rules_send_gift',
'parameter' => array(
'sender' => array('type' => 'user', 'label' => t('Sender of the gift')),
'receiver' => array('type' => 'user', 'label' => t('Receiver of the gift')),
'node' => array('type' => 'node', 'label' => t('Gift node'), 'bundles' => $giftContentTypes),
'comment' => array('type' => 'text', 'label' => t('Gift comment')),
)
)
);
}
?>Thanks!