How to use parameters with ibexa_render and ibexa_render_location

Code ibexa_render

10 Mar 2026

If you have been developing on Ibexa for a few years, you have probably got into the habit of using the Symfony controller ibexa_content::viewAction to pass custom parameters to a view.

Those days are over. With parameter support arriving in the native Twig functions, the tide is turning. Here is why you should change your habits today.

The showdown: old vs new

The old way (standard Symfony)

We used a Symfony sub-request to inject our data:

   

{# ❌ Now to be avoided for simple renders #}
{{ render(controller('ibexa_content::viewAction', {
    'contentId': content.id,
    'viewType': 'line',
    'params': { 'my_param': 'custom_data' }
})) }} 
   

The new way (native Ibexa)

We use the dedicated helper, which handles everything internally:

   

{# ✅ The current recommendation #}
{{ ibexa_render(content, {
    'viewType': 'line',
    'params': { 'my_param': 'custom_data' }
}) }} 
   

Why choose ibexa_render?

1. Performance: goodbye to unnecessary sub-requests

Symfony's render(controller(...)) function creates what is known as a sub-request. The Symfony kernel has to recreate a complete lifecycle (Request, Kernel Events, etc.). By contrast, ibexa_render with the default method (direct) calls the rendering engine directly. It is lighter, faster and uses less memory.

2. Readability and intent

By using ibexa_render, you clearly state that you are rendering a CMS object. The code is shorter and much easier to maintain for a developer new to the project.

3. Native flexibility

The params block of the Twig function does exactly the same thing as the controller's. You lose no functionality, but you gain clarity.

How do you update your templates?

The switch is painless. In your target template (your "View Template"), nothing changes. The variables you pass in the params array remain accessible under the same name.

Migration example:

  1. Identify your render(controller(...)) calls.
  2. Replace them with ibexa_render(content, { ... }) or ibexa_render_location(location, { ... }).
  3. Enjoy cleaner code.