You are here

function rules_action_variable_add_info_alter in Rules 7.2

Info alteration callback for variable add action.

Related topics

File

modules/data.eval.inc, line 176
Contains rules integration for the data module needed during evaluation.

Code

function rules_action_variable_add_info_alter(&$element_info, RulesAbstractPlugin $element) {
  if (isset($element->settings['type']) && ($type = $element->settings['type'])) {
    $cache = rules_get_cache();
    $type_info = $cache['data_info'][$type];
    $element_info['parameter']['value']['type'] = $type;
    $element_info['provides']['variable_added']['type'] = $type;

    // For lists, we default to an empty list so subsequent actions can add
    // items.
    if (entity_property_list_extract_type($type)) {
      $element_info['parameter']['value']['default value'] = array();
    }
  }
}