You are here

function patterns_feed_rearrange_data in Patterns 6.2

Same name and namespace in other branches
  1. 6 patterns.module \patterns_feed_rearrange_data()
  2. 7.2 includes/feed.inc \patterns_feed_rearrange_data()
  3. 7 includes/feed.inc \patterns_feed_rearrange_data()
1 call to patterns_feed_rearrange_data()
patterns_import_server_validate in ./patterns.module

File

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

Code

function patterns_feed_rearrange_data($feed) {
  unset($feed['tag']);
  foreach ($feed as $key => $section) {
    $tag = $section['tag'];
    if ($tag == 'pattern') {
      unset($section['tag']);
      if (!isset($section['value'])) {
        foreach ($section as $t) {
          if ($t['tag'] == 'pid') {
            $pid = $t['value'];
            break;
          }
        }
        $result[$pid] = patterns_feed_rearrange_data($section);
      }
      else {
        $result[$tag] = $section['value'];
      }
    }
    else {
      unset($section['tag']);
      if (!isset($section['value'])) {
        $result[$tag] = patterns_feed_rearrange_data($section);
      }
      else {
        $result[$tag] = $section['value'];
      }
    }
  }
  return $result;
}