Hi all,

I am stuck on how to include the formatting for a text field (that is excluded from display) when I print the value of that field in a customfield.

1. I have gotten the data from the field I need, and excluded it from display. I have also confirmed that the output of this field does include the HTML formatting (line/paragraph breaks) at this stage.

2. I am able to successfully get the contents of the field to display in a customfield (within a collapsible fieldset) via the code below, but any formatting from that field disappears. I have checked my Input Format settings, as well as made sure that all the views/field output stuff can contain HTML. Still no luck!

3. I think that whatever is stripping the HTML is happening with my PHP... Has anyone done this before, or can anyone offer some tips?


<?php
drupal_add_js('misc/collapse.js');
?>

<fieldset class=" collapsible collapsed">
  <legend>Discussion and notes</legend>
  <div class="fieldset-wrapper">

     <?php print $data->node_data_field_notes_field_notes_value; ?>

  </div>
</fieldset>

Thanks!

Comments

intyms’s picture

about formatting
use check_markup() function to display your variable using Input Format filters.
example:

     $field_notes_formated = check_markup($data->node_data_field_notes_field_notes_value, $format = FILTER_FORMAT_DEFAULT, $check = TRUE);
     print $field_notes_formated;

see filter.module from "modules/filter" directory to find more information about check_markup() function

intyms’s picture

about collapsible fieldsets
i would suggest to use "CTOOLS collapsible fieldsets". They are easier to theme.

to do this, install CTOOLS module from here
add the following code into the header of yout views:

    drupal_add_js('sites/all/modules/ctools/js/collapsible-div.js');

add this code into your php custom field:

<div class="ctools-collapsible-container ctools-collapsed">
		<div class="ctools-collapsible-handle">
                       place here the title of the fieldset              
		</div>
		<div class="ctools-collapsible-content">
                       place here the content of the fieldset              
		</div>
</div>

more information about ctools collapsible fieldsets you can find in the following file:
yoursitedir/sites/all/modules/ctools/js/collapsible-div.js

intyms’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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