I'm new to writing modules and back end dev. I'm trying to write a custom Rules action that takes a list and returns one item from that list to use as a relationship end point.
I've declared the rule here and got it working as far as I can extract one item from the list and put it as a message on screen:
function rules_additions_rules_action_info() {
$actions = array(
'rules_additions_action_get_next_list_item' => array(
'label' => t('Get next list item'),
'group' => t('Data'),
'parameter' => array(
'list' => array(
'type' => 'list',
'label' => t('Select the current list'),
),
),
),
);
return $actions;
}
And can do something like this, for example:
function rules_additions_action_get_next_list_item($list) {
drupal_set_message(t('The item is ' . print_r($list[0], TRUE)), 'status');
}
What I want to be able to do is return that list item as an entity so at the next step in my rule set I can do "Add an item to a list" and select it in the rules UI.
I hope this makes sense.
Thanks in advance.