You are here

function patterns_php_action in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/core/php.inc \patterns_php_action()

Execute a single pattern action.

@TODO Doc.

Parameters

array $action:

mixed $place index of the current operation within the batch_set: s_map [$pid pattern id, $index ??]

1 call to patterns_php_action()
patterns_execute_pattern_php in includes/core/php.inc
Execute a Pattern. Actions will be called sequentially.

File

includes/core/php.inc, line 88
A simple, sequential version of running patterns.

Code

function patterns_php_action($action, $data, $place, $actions_map) {
  patterns_io_load_components();

  // TODO: move this out of here?
  // Nothing to do if there is no action
  if (empty($data) || empty($action)) {
    drupal_set_message(t('Cannot execute empty action.'), 'error');
    return FALSE;
  }

  // $actions passed as reference.
  $results = patterns_prepare_action($action, $data);
  if ($results['status'] == PATTERNS_ERR) {
    return $results;
  }
  $identifiers = array();
  return patterns_implement_action($action, $data, $identifiers, $place, $actions_map);
}