You are here

function podcast_process_nested_channel_element in Podcast (using Views) 8

If an element contains nested values we serialize the markup here.

The serialization is then stored in the `'value'` key.

Parameters

array $element: The element containing the nested values.

1 call to podcast_process_nested_channel_element()
podcast_preprocess_views_view_rss in ./podcast.module
Implements hook_preprocess_HOOK().

File

./podcast.module, line 67
Primary module hooks for the podcast module.

Code

function podcast_process_nested_channel_element(array &$element) {
  $values = $element['values'];
  if (!is_array($values)) {
    return;
  }
  $output = array_reduce($values, function ($out, $value) {
    if ($content = $value['value']) {
      $out .= sprintf('<%s>%s</%s>', $value['key'], $content, $value['key']);
    }
    else {
      $out .= sprintf('<%s />', $value['key']);
    }
    return $out;
  }, '');
  $element['value'] = Markup::create($output);
}