You are here

function patterns_from_source in Patterns 6.2

Same name and namespace in other branches
  1. 5 patterns.module \patterns_from_source()
  2. 6 patterns.module \patterns_from_source()

Create a pattern from an XML data source

2 calls to patterns_from_source()
patterns_import_server_validate in ./patterns.module
patterns_load_string_xml in ./patterns.module

File

./patterns.module, line 1213
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_from_source($xml) {
  $parse = drupal_xml_parser_create($xml);
  xml_parser_set_option($parse, XML_OPTION_CASE_FOLDING, 0);
  if (!xml_parse_into_struct($parse, $xml, $vals, $index)) {
    return false;
  }

  // Create a multi-dimensional array representing the XML structure
  $pattern = current(_patterns_parse_tag($vals));
  return $pattern;
}