You are here

function rules_action_data_list_add in Rules 7.2

Action: Add a list item.

Related topics

1 string reference to 'rules_action_data_list_add'
rules_data_action_info in modules/data.rules.inc
Implements hook_rules_action_info() on behalf of the pseudo data module.

File

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

Code

function rules_action_data_list_add($list, $item, $unique, $pos, $settings, $state) {

  // Optionally, only add the list item if it is not yet contained.
  if ($unique && rules_condition_data_list_contains($list, $item, $settings, $state)) {
    return;
  }
  switch ($pos) {
    case 'start':
      array_unshift($list, $item);
      break;
    default:
      $list[] = $item;
      break;
  }
  return array(
    'list' => $list,
  );
}