I've looked for documentation on this, and the closest I could find is here: How to use a text parameter passed to an event in a textarea in an action. The best answer given there is a workaround to tokenize the string and then pass and use that token in conditions/actions. But it's a workaround, and it's for D7... I don't think tokens are an acceptable rules data type in D6.

But I have basically the same use case - I want to map a string passed from a custom event to a condition. As far as I can tell, the string I set when invoking the event is inaccessible from conditions/actions - and in fact an empty field is presented to overwrite the variable on the condition configuration page. I think this is because, according to the rules data types page, strings are a data type that use an input form. Thing is, I don't want to use an input form - I want to map the string from the invoked event to the condition. How do I do this properly?

My best guess was to create a new data type with "'uses_input_form' => FALSE". So, looking at the documentation for adding a new data type, I understand that I would set up hook_rules_data_type_info() like below


/**
* Implementation of hook_rules_data_type_info()
*/
function mymodule_rules_data_type_info() {
  return array(
    'number' => array(
      'label' => t('MyModule'),
      'class' => 'rules_data_type_my_string',
      'identifiable' => FALSE,
      'uses_input_form' => FALSE,
      'eval input' => TRUE,
    ),
  );
}

What I'm unclear on, if this is indeed what I should be doing, is how to implement my new data type's class properly. Any help would be extremely appreciated.

See In D6 Rules, how do I grab a string variable from an event?, from stackexchange, for more info.

Comments

TR’s picture

Status: Active » Closed (outdated)