Hi, and thx for the great module.

On enclosure fields, using image fields, the code generated in the feed doesn't render html special chars. :

<enclosure> &lt;enclosure url=&quot;[image-url]&quot; length=&quot;[length]&quot; type=&quot;image/jpeg&quot; /&gt;
</enclosure>

Everything is working well in views_rss_core_field_formatter_view, until '#markup' => format_xml_elements(array($rss_element)),, I guess.

Any idea ?

Thx !

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daniel Song’s picture

Same problem I'm seeing.

Please, fix this ASAP. This causes lots of problem of podcast.

math-hew’s picture

Make sure you're setting this on your image field.

davidneedham’s picture

Status: Active » Closed (works as designed)

Thanks @math-hew - I was having this problem and indeed had that setting incorrect.

I'm going to set the status, but reopen if this doesn't work for others.

gregory_kapustin’s picture

For my part @math-new, this setting was already right...

Still same problem though :(

Hint : I'm using a relationship to obtain the image (thx scald... :/)

gregory_kapustin’s picture

Status: Closed (works as designed) » Active
maciej.zgadzaj’s picture

Status: Active » Postponed (maintainer needs more info)

@Gregory: please make sure you use the latest dev version of the module, and that you use RSS <enclosure> element as field formatter - it should work fine then (just re-tested on my local sandbox). If you still experience the problem, please provide screenshots of your feed configuration (including image field config) and link to the feed.

gregory_kapustin’s picture

Status: Postponed (maintainer needs more info) » Active

Ok I got it : it's the using of Rewrite results and / or No results text that causes the problems.

As soon as you use one of them, all html marks are unrendered - you can reproduce it by simply rewriting a body field using [body].

maciej.zgadzaj’s picture

Hold on, the original issue was about <enclosure> element, so why are we talking about Body field here?

gregory_kapustin’s picture

EDIT : body field rewriting works fine.

What messed my view is using of "cascading fields" - I mean [field_1] (visible) -> rewrite if empty [field_2] (hidden) -> rewrite if empty [field_3] (hidden) .

In that case, problem is : what setting do I use for fields 2 and 3 ?

gregory_kapustin’s picture

Category: bug » support
maciej.zgadzaj’s picture

Category: support » bug
Priority: Major » Normal
Status: Active » Closed (works as designed)

Well, this issue was about <enclosure> element, so let's stick to it here.

Now, rewriting doesn't really change anything, as long as you don't change the type of value the field provides. Which means, if you have a field named field_images, you can rewrite the output using [field_images] and everything still works fine.

Of course, if you decide to replace this with, say, hardcoded URL, obviously it won't work anymore, as it expects to have image object, not its URL only. The same applies to using No results text, but that's expected behavior.

maciej.zgadzaj’s picture

Category: bug » support
gregory_kapustin’s picture

Category: support » bug
Status: Closed (works as designed) » Active
FileSize
29.97 KB

Problem is, all my image fields are in enclosure format, and as soon as I use this cascading rewriting, all is broken :

<enclosure>
 &lt;enclosure url=&quot;http:/.....jpg&quot; length=&quot;2988&quot; type=&quot;image/jpeg&quot; /&gt;
</enclosure>

See picture attached.

maciej.zgadzaj’s picture

Category: bug » support

Ok, now I see what you are trying to do. And that's right, it is not going to work, because Field_1 returns already formatted <enclosure> element, while Field_2 expects image object instead. It's not a bug, this is how Views module works. And there is no way around it without custom coding I'm afraid. (Also, this is an edge case, and as such I'm not planning to account for it in the module.) You might want to implement custom enclosure preprocess function for this field, and put all the logic there (passing image object from Field_1 to Field_2 to Field_3 if needed.)

gregory_kapustin’s picture

Category: support » bug
Status: Active » Closed (won't fix)

Thx @maciej.zgadzaj, I guess we arrived to the point.

I'll try some custom coding and post it here fyi.

markie’s picture

Issue summary: View changes

FWIW: I ran into this issue and to correct it, I had to uncheck all the style settings (default classes et al) and make sure there was no re-write results checked. Once I did that, it became pretty again.

MediaFormat’s picture

I ended up using hook_views_pre_render

function MYTHEME_views_pre_render(&$view) {
  if(isset($view->name) && $view->name == 'taxonomy_term'){
    foreach($view->result as $r){
      //var_dump($r);
      if((empty($r->field_field_image[0])) && !empty($r->field_field_img_principale[0])){
	$r->field_field_image[0]['rendered']['#rss_element'] = $r->field_field_img_principale[0]['rendered']['#rss_element'];
      }  
    }
  }
}