function patterns_reformat_actions in Patterns 7.2
Same name and namespace in other branches
- 7 includes/core/common.inc \patterns_reformat_actions()
Group the action and the data fields.
Parameters
array $actions The array of actions.:
2 calls to patterns_reformat_actions()
- patterns_execute_pattern_batch in includes/core/ batch.inc 
- Starts preliminary operations for pattern execution.
- patterns_execute_pattern_php in includes/core/ php.inc 
- Execute a Pattern. Actions will be called sequentially.
File
- includes/core/ common.inc, line 360 
- The common functions used by the Batch and PHP running modes.
Code
function patterns_reformat_actions(&$actions) {
  $valid_actions = patterns_actions();
  $newactions = array();
  foreach ($actions as $key => $value) {
    //$found = FALSE;
    foreach ($value as $akey => $avalue) {
      if (!array_key_exists($akey, $valid_actions)) {
        // Should not happen.
        drupal_set_message(t("Invalid action: %action.", $akey), 'error');
      }
      else {
        $newactions[] = array(
          'action' => $akey,
          'data' => $avalue,
        );
      }
    }
  }
  $actions = $newactions;
}