CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views 3 Integration - support html markup in Notes field types
Pages: [1]

Author Topic: Views 3 Integration - support html markup in Notes field types  (Read 2077 times)

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Views 3 Integration - support html markup in Notes field types
June 19, 2012, 06:07:42 am
Views does not handle the Notes field correctly, but displays the html tags and does not check_markup()

This is a repost of a 2010 instance of the same issue: http://forum.civicrm.org/index.php/topic,10259.0.html

I tried to follow the hint (from that posting) to create a custom views field tpl.php, but I'm not savvy enough to get it to work for me.  :-[

I'm on D7, Views3 and CiviCRM 4.1.2

Would appreciate any direction or guiding steer. Thanks!

DD

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Views 3 Integration - support html markup in Notes field types
June 19, 2012, 02:41:39 pm
Quote from: ddunn on June 19, 2012, 06:07:42 am

I tried to follow the hint (from that posting) to create a custom views field tpl.php, but I'm not savvy enough to get it to work for me.  :-[

Click on Advanced, then "Information" next to Theme, when editing your View.

Then find the file you want to replace, choose one of the non-bold names and create a file with that name in your theme directory. Put in that file the code from that other post.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Views 3 Integration - support html markup in Notes field types
June 20, 2012, 01:19:58 am
Hi Hershel,

Thanks - that's opened up a whole world of theming customisation for me.

I've managed to be able to correctly create a tpl.php file to override the default theming. However, I'm still not managing to achieve the desired result.  :(

Applying check_markup($row, 1)  [ and check_markup($field->raw, 1) ] displays nothing for me.

I noticed something, which I'm not sure is relevant. If I choose, in Views UI, to remove all html from the field. The display still presents the html tags

Code: [Select]
<p> Loads of details</p> <p> Even some more:</p> <ul> <li> first</li> <li> second</li> <li> third</li> <li> fourth</li> </ul>
Looking at it when this option is not selected, the output looks like this:

Code: [Select]
<span class="field-content"><p>&lt;p&gt;<br>
Labels&lt;/p&gt;<br>
&lt;p&gt;<br>
Even some more:&lt;/p&gt;<br>
&lt;ul&gt;<br>
&lt;li&gt;<br>
first&lt;/li&gt;<br>
&lt;li&gt;<br>
second&lt;/li&gt;<br>
&lt;li&gt;<br>
third&lt;/li&gt;<br>
&lt;li&gt;<br>
fourth&lt;/li&gt;<br>
&lt;/ul&gt;</p></span>

So, I'm still all confused. Can you spot what I'm doing wrong?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Views 3 Integration - support html markup in Notes field types
June 20, 2012, 01:58:34 am
I'm not sure. I would have to see the site.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Views 3 Integration - support html markup in Notes field types
June 20, 2012, 02:29:41 am
I'm heading out now to an all day event, but maybe you could take a look if I sent you the details later on?

I'd much appreciate it, and would love to help with anything (perhaps documentation) in return.

Thanks

David

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Views 3 Integration - support html markup in Notes field types
June 20, 2012, 03:12:30 pm
I found a work-around.

I set the field to 'Exclude from Display', and then using the Views PHP http://drupal.org/project/views_php module, I created a Global PHP field, and used

Code: [Select]
<?php print($row->my-field-name) ; ?> as the output code.

where my-field-name is offered as an available variable in that Global: PHP field.

The result is that the html markup is being respected in the output. (Oh Happy Dave!)

Note: I thought that using the same idea principal with Global: Custom Text would do the trick, but alas no. For some reason, Drupal / Views / CiviCRM Views integration doesn't like the content of CiviCRM Notes (Memos / Text) fields, and won't display them like native Drupal LongText fields and apply the html contained therein.

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Views 3 Integration - support html markup in Notes field types
June 20, 2012, 03:25:41 pm
Note 2: I thought, afterwards, that this problem might only be due to the Note field in question being in one of my Custom fields. But I tried to also include the standard Activity Details field (which is the same field type (i.e. accepts html input) and the same problem presented. Again, the workaround with Views PHP worked.

Thanks to Hershel for the help troubleshooting this.

d

torrance123

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 3
  • CiviCRM version: 4.0
  • CMS version: Drupal 7
  • MySQL version: 5.0.91
  • PHP version: 5.3.3
Re: Views 3 Integration - support html markup in Notes field types
July 08, 2012, 06:52:25 pm
I've made a couple of patches to Civicrm's Views module that should resolve this issue, hopefully to be included in 4.2.

http://issues.civicrm.org/jira/browse/CRM-10497

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Views 3 Integration - support html markup in Notes field types

This forum was archived on 2017-11-26.