You are here

function patterns_load_string_xml in Patterns 6.2

Same name and namespace in other branches
  1. 6 patterns.module \patterns_load_string_xml()
1 call to patterns_load_string_xml()
patterns_load_xml in ./patterns.module

File

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

Code

function patterns_load_string_xml($source) {
  $pattern = patterns_from_source($source);
  if (empty($pattern) || $pattern['tag'] != 'pattern') {
    return FALSE;
  }

  // Rearrange the data in a nice way for each component.
  // Make sure actions are processed differently so order is preserved.
  $pattern = patterns_rearrange_data($pattern);
  foreach ($pattern as $key => $values) {
    $pattern[$values['tag']] = $values;
    unset($pattern[$values['tag']]['tag']);
    unset($pattern[$key]);
  }
  if (!patterns_validate_pattern($pattern)) {
    return FALSE;
  }
  return $pattern;
}