Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[SOLVED] 2.4 -> 3.1 - How to parse fields for template includes


4 Posts   269 Views


24 March 2014 at 7:37pm Community Member, 604 Posts

So I have a HTMLText field on an object that is plonked in an include. This field often contains an internal link like [sitetree_link id=113]. I found if I put that direct into the template, the link shortcode is not parsed.

So in 2.4 I did this, which worked perfectly:

function GetCleanInclusions() {
      return DBField::create('HTMLText', $this->TourInclusions);

In 3.x, DBField is abstract and can't be instantiated. I've had a dig around, mainly in the HTMLText model class itself, and I can't find the equivalent for the latest SS.

Just like 2.4, returning the field direct results in the include displaying the text, but the link is still un parsed.



24 March 2014 at 9:15pm Forum Moderator, 474 Posts

You use DBField::create_field instead of DBField::create (there's been a move away from overloading create())


24 March 2014 at 9:30pm Community Member, 604 Posts

Perfect Simon. Thank you.


16 July 2014 at 2:08am Community Member, 3 Posts

Hi Guys,

I've got the same issue.

Could you give a clear walkthrough where the file is located that I need to edit please?

I just can't seem to figure this one out.

Thanks for your help!!