Page List - preserve line break formatting

Permalink
The new C5 PageList is more complicated. In the good old days of about 1 year ago, it seems you could just change line 20 in concrete/blocks/pagelist/view.php from

echo $cobj->getCollectionDescription();

to

echo nl2br($cobj->getCollectionDescription());

and the line breaks would be honored from your Page Description to the Page List output.

Now the code is significantly more complicated with some helpers and whatnot:

<?php  
      if(!$controller->truncateSummaries){
         echo $textHelper->entities($cobj->getCollectionDescription());
      }else{
         echo $textHelper->entities($textHelper->shorten($cobj->getCollectionDescription(),$controller->truncateChars));
      }
      ?>


There is a $textHelper->entities now where I'd like to put the "nl2br." So where do I put this "nl2br?"

 
zoinks replied on at Permalink Best Answer Reply
Welp, I took a risk and apparently got it right.

Change lines 26-32 to (I added comments so you could see exactly what I changed):

<?php  
      if(!$controller->truncateSummaries){
         //nl2br preserves the line breaks 
         echo nl2br($cobj->getCollectionDescription());
      }else{
         //nl2br preserves the line breaks 
         echo nl2br($textHelper->shorten($cobj->getCollectionDescription(),$controller->truncateChars));
      }
      ?>