I have a template with a line like this:
<f:format.htmlentitiesDecode>
{product.features}
</f:format.htmlentitiesDecode>
where "features" is an attribute of the "product" data model.
I would like to print the result if a method call on product instead. Something like:
<f:format.htmlentitiesDecode>
{product.getStrippedFeatures}
</f:format.htmlentitiesDecode>
but that gives me empty content.
How can I call a method in the product model and print its output?
Just add the function in your product model like:
public function getStrippedFeatures()
{
return your_stripping_method($this->features);
}
Fluid calls attributes with a prefixed get, so you only need this in the template:
{product.strippedFeatures}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With