Search code examples
typo3fluid

In fluid, how do I use a widget only if it exists?


I am making a sitepackage to be compatible with TYPO3 9 & 10. However it is using the news extension which changes the way pagination is done.

Is there a way in fluid to do something like:

<f:if condition="n:widget.paginate">
  <f:then>
    Use n:widget.paginate
  </f:then>
  <f:else>
    Use newer paginate method
  </f:else>
</f:if>

Solution

  • By default there is no such condition.

    You might define a view helper to check the installation of an extension and the extension version. Or you use a view helper to check the existence of a class representing the view helper.

    In ext:vhs you find a view helper to check if an extension is loaded and a try view helper to catch a rendering error.