You are here

function _patterns_xmlparser_process_action in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_xmlparser/patterns_xmlparser.module \_patterns_xmlparser_process_action()
1 call to _patterns_xmlparser_process_action()
patterns_xmlparser_rearrange_data in patterns_xmlparser/patterns_xmlparser.module

File

patterns_xmlparser/patterns_xmlparser.module, line 165

Code

function _patterns_xmlparser_process_action($action = NULL) {
  if (is_null($action)) {
    return array();
  }
  $tag = array(
    'tag' => @$action['tag'],
  );

  // TODO: check when this does not exist
  $_action = $action['xml_tag'];

  // TODO: check that is a valid one and that exist
  if ($_action == PATTERNS_INCLUDE) {

    // If the pattern is included by reference add it
    // immediately, otherwise reparse the whole included pattern

    //$inclusion = $action[0]['value'];

    //if (is_array($inclusion)) {
    if (!isset($action[0]['value'])) {
      $inclusion = patterns_xmlparser_rearrange_data($action[0]);
    }
    else {
      $inclusion = $action[0]['value'];
    }
    $_action_data = array(
      'pattern' => $inclusion,
    );
  }
  else {
    $_action_data = _patterns_xmlparser_rearrange_data($action);
    unset($_action_data['xml_tag']);
  }
  return array(
    $_action => $_action_data,
  );
}