Hi I've been reading the documentation for hook_rules_action_info() and am not clear on what parameter types are available. I would like to define a setting for the action as a select box with a defined set of options. I've tried using 'select' as the type, but that always limits the input to the select mode and not a select box. I've also set the 'options list' field, but those values don't show up when 'select' is the type. I tried using 'text' as the type, but if I have an options list I get an ajax error. How should I go about defining a select box with my own options list?
Documentation says: type: The rules data type of the parameter, which is to be passed to the action. All types declared in hook_rules_data_info() may be specified, as well as an array of possible types. Also lists and lists of a given type can be specified by using the notating list as introduced by the entity metadata module. The special keyword '*' can be used when all types should be allowed. Required.
This isn't super descriptive. What is "an array of possible types"?
thanks.
Comments
Comment #1
acrazyanimal commentedHeh! Just figured it out. Somehow I missed the part of the documentation that says the 'options list' is a callback!!! Very important detail. I had passed and array as a variable. So sorry for adding to the issue queue, frustration makes you do crazy things sometimes.
options list: (optional) A !!! callback !!! that returns an array of possible values for this parameter. The callback has to return an array as used by hook_options_list(). For an example implementation see rules_data_action_type_options().
Comment #2
drupadawan commentedI am searching for a way to pass a parameter to the options list callback:
I declare a condition, then let the user select a form_state, and then I want him to select a field from that form state through a dropdownlist, yet to do this I have to pass the form_state the the options_list callback (eg 'get_fields(form_state)')
anybody who knows how I'd do this?
Comment #3
tr commentedThe original question was answered by #1.
As for #2, you can't pass arguments to an options list callback.