0

How can I print out $variables from template_preprocess_views_view_rss() in a readable format? The RSS view page uses a non-rendering format and is impossible to read. I need to manipulate the feed because no D8 RSS module is stable at this point.

0

My solution was to use kint() and print_r() with array_keys() to locate all the objects for manipulation. In some cases I was debugging with the kint() display and in others just looking at plain text by using the other mentioned functions.

For note the template_views_view_rss() and template_views_view_row_rss() hooks are located in view.theme.inc (core) and no where in documentation on drupal.org for D8. I believe they are soon to be deprecated.

// Specific feed filter
if( $variables['view']->id() == 'blog' && $variables['view']->current_display == 'feed_1') {
  // Iterate rows
  foreach($variables['rows'] as $key_1 => $row) {
    // Do stuff
    foreach($row['#row']->elements as $key_2 =>  $element) {
      // Do stuff
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.