Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dmitriy.trt’s picture

Status: Active » Needs review
FileSize
2.74 KB

Patch with implementation.

aoturoa’s picture

thanks Dmitriy.trt for the patch, exactly what i needed.
I made small change so the CDATA is not applied on empty content.

Sorry for not using git patch, but the code below is pretty self explainable.

Index: views_data_export.theme.inc
===================================================================
--- views_data_export.theme.inc	(revision 681)
+++ views_data_export.theme.inc	(working copy)
@@ -383,7 +383,7 @@
           array('<', '>'),
           $content);
       }
-      else{
+      elseif(!empty($content)) {
         // Escape CDATA end sequence only.
         $content = '<![CDATA[' . str_replace(']]>', ']]]]><![CDATA[>', $content) . ']]>';
       }
klausi’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
2.24 KB

Patch looks RTBC to me, integrated the suggestions from #2.

Dmitriy.trt’s picture

Status: Reviewed & tested by the community » Needs work

Zero will not be wrapped with CDATA. It's just a guess. Please set back to RTBC if I'm wrong.

klausi’s picture

Status: Needs work » Needs review
FileSize
2.24 KB

Right, we should better check for the empty string instead of using empty().

Dmitriy.trt’s picture

Integer zero can't get here, right? Asking because 0 != '' results in FALSE and integer zero still won't be wrapped. Sorry I don't have this module installed at the moment and can't dig into it with debugger or properly analyze the code.

Leo Pitt’s picture

Hi, it would be great if it were possible to apply CDATA to individual fields rather than all fields in the view.

junedkazi’s picture

Ok so I need it to be based on per field. So I am attaching a patch for review.Also a cleanup as there were some + signs in the comments.

junedkazi’s picture

Setting it to needs review.

Status: Needs review » Needs work

The last submitted patch, xml_field_cdata-1465432-8.patch, failed testing.

junedkazi’s picture

Status: Needs work » Needs review
FileSize
3.12 KB
Steven Jones’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This patch looks okay, but we need some tests to make sure this functionality works. There should be test for not-escaping certain fields, which would be a good basis for a test.

Steven Jones’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
6.46 KB

Here's a patch for the testbot.

Steven Jones’s picture

Status: Needs review » Fixed
Issue tags: +Needs tests

Thanks everyone, committed to 7.x-3.x.

Steven Jones’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Fixed » Patch (to be ported)

Now needs backporting.

junedkazi’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.21 KB
junedkazi’s picture

Issue summary: View changes

removed comments that were potentially unrelated to the feature request/issue

  • Steven Jones committed 002f4e6 on 7.x-4.x
    Issue #1465432 by klausi, junedkazi, Dmitriy.trt, Steven Jones |...
Steven Jones’s picture

Issue summary: View changes
Status: Needs review » Fixed

@junedkazi thanks for the patch!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.