You are here

function node_patterns_params in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_components/components/node.inc \node_patterns_params()

File

patterns_components/components/node.inc, line 351

Code

function node_patterns_params($action, $form_id, &$data = NULL, &$a) {
  $status = PATTERNS_SUCCESS;
  $msg = '';
  $result = NULL;
  if ($form_id == 'node_delete_confirm') {
    $result = array(
      (object) $data,
    );
  }
  elseif ($action === PATTERNS_MODIFY and $form_id == 'node_type_form' or $form_id == 'node_type_delete_confirm') {
    $types = (object) _node_types_build();
    $type = $types->types[$data['type']];
    $result = array(
      $type,
    );
  }
  else {

    // other cases, Node create&modify
    $data['node']->language = 'und';
    $result = clone $data['node'];

    //  $result = array(array(
    //    'bundle' => 'article',
    //    'entity_type' => 'node',

    ////    'field_name' => $data['field_name'],

    //));
  }
  return patterns_results($status, $msg, $result);
}