function patterns_feed_rearrange_data in Patterns 7
Same name and namespace in other branches
- 6.2 patterns.module \patterns_feed_rearrange_data()
- 6 patterns.module \patterns_feed_rearrange_data()
- 7.2 includes/feed.inc \patterns_feed_rearrange_data()
1 call to patterns_feed_rearrange_data()
- patterns_import_server_validate in includes/
servers.inc - Form submission handler for patterns_import_server().
File
- includes/
feed.inc, line 59 - Patterns feed functions.
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;
}