hi,

i'm trying to add some glue between rules and domain access. do have some success already. means ok, it is possible to create domains on events and evetns are triggered if domains are created ...

i just changed a couple of things and therefore i am transmitting different arguments with an event. so i encountered a problem which i was not able to solve already:

my event_info declares an argument array with one argument like this: 'url' => array('type' => 'string', 'label' => t('subdomain as a string.'))
the event is issued in a forms submit handler: rules_invoke_event('chillkraft_rules_event_info', array('url' => $subdomain));
the action_info wrapping the domain module declares an argument like this: 'url' => array('type' => 'string', 'label' => t('url of new site.')),

even having the same type of argument in action and event they don't match. the form still asks me to enter a string for 'url of new site'.

as far as i got from docs there are 3 ways of submitting arguments:

1.) via configuration - these do not appear in action_info at all but carry a form.inc
2.) as above
3.) dynamically created via handler function

true?

cheers,

/markus

rules rule ;-)

Comments

markus61’s picture

Component: Provided module integration » Rules Engine
markus61’s picture

rules_invoke_event('chillkraft_rules_event_info', array('url' => $subdomain)); needs to be: rules_invoke_event('domain_roles_create_domain', array('url' => $subdomain));

but still some strange things.

apparently there is something wrong with my action declaration:

/**
* Implementation of hook_rules_action_info
*/
function domain_roles_rules_action_info() {
return array(
'domain_roles_create_domain' => array(
'label' => t('Create a new Site from subdomain string.'),
'arguments' => array(
'subdomain' => array('type' => 'value', 'label' => t('the new site (xxx.chillkraft.net).')),
),
'new variables' => array(
'domain_added' => array('type' => 'domain', 'label' => t('New domain')),
),
'module' => 'Domain',
),
'domain_roles_action_user_addrole' => array(
'label' => t('Add user to role for specific site'),
'arguments' => array(
'domain' => array('type' => 'domain', 'label' => t('Site for which the user should get a role.')),
'user' => array('type' => 'user', 'label' => t('User who should get the role.')),
),
'module' => 'User',
),
'domain_roles_action_add_user_to_domain' => array(
'label' => t('Add user to domain'),
'arguments' => array(
'domain' => array('type' => 'domain', 'label' => t('Domain to which user will be added.')),
'user' => array('type' => 'user', 'label' => t('User, who will be added to domain.')),
),
'module' => 'User',
);
}

this declaration behaves as expected when uilding the admin form but throws a warning when saving the form:

warning: Invalid argument supplied for foreach() in /usr/share/apache2/drupal/sites/all/modules/rules/rules/rules.admin_rule_proxy.inc on line 280.

/markus

markus61’s picture

just tried to reproduce above behaviour with the rules supplied by rules.module. yes, same thing.
i use beta5 and
- introduce a rule for the event "user page has been viewed"
- add an action that provides new variables like "load a user account"
- save it

you should see the same warning.

hmm.. maybe i should file a bug report for this one.

cheers,

/markus

markus61’s picture

Status: Active » Closed (fixed)