I'm missing a 'value' property that will allow me to silently pass a value.
My use case is taxonomy integration and the use of 'base' property. I'd like my form to know which vocab has been chosen.
Notice the use of 'value' => $vocabulary->vid,:

/**
 * Implementation of hook_rules_action_info().
 */
function taxonomy_rules_action_info() {
   $info = array();
  // Get existing taxonomy vocabulries.
  $vocabularies = taxonomy_get_vocabularies();
  foreach ($vocabularies as $vocabulary) {
  	$info['rules_action_taxonomy_assign_term_to_content_'. $vocabulary->vid] = array(
  	  'label' => t('Assign a term from vocabulary "') . $vocabulary->name . t('" to content'),
      'arguments' => array(
        'node' => array(
          'type' => 'node', 
          'label' => t('Content which term will assigned to')),    
        ),
      'base' => 'rules_action_taxonomy_assign_term_to_content',
      'value' => $vocabulary->vid,
      'description' => t('Assign a certain taxonomy term to the content.'),        
      'module' => 'Taxonomy',
    );
  }
  return $info;
}

Comments

amitaibu’s picture

Maybe better to put value in arguments:

...
      'arguments' => array(
        'vocabulary' => array(
          'type' => 'object',
          'label' => t('The vocabulary that was chosen')),
          'value' => $vocabulary,
        ),
...

So it is loaded as an argument.

fago’s picture

interesting idea. Note that your first example works already - I've done the same if you have a look at rules_rules_action_info() where i pass the set_name and read it out from $element['#info'] later on.

However I like the idea of adding it as "fixed" argument.

fago’s picture

Status: Active » Fixed

I've just implemented this.

It works with the data type 'value'


      'arguments' => array(
        'vocabulary' => array(
          'type' => 'value',
          'default value' => $value,
        ),

Furthermore there is now support for 'default value' for every data type :)

amitaibu’s picture

Awesome! :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

mitchell’s picture

Component: Code » Rules Core

Updated component.