Skip to content

Conversation

@vidarl
Copy link
Contributor

@vidarl vidarl commented Nov 3, 2025

🎫 Issue IBX-3035

Description:

When using render(controller('ibexa_content::viewAction')), you can send parameters to the controller which will be available in the template.

Example:

    <h2>render controller</h2>
    {{ render(controller('ibexa_content::viewAction', {
        'contentId': content.id,
        'viewType': 'line',
        'params':
            { 'my_param': 'custom_data', }
    })) }}

    <h2>render_esi controller</h2>
    {{ render_esi(controller('ibexa_content::viewAction', {
        'contentId': content.id,
        'viewType': 'line',
        'params':
            { 'my_param': 'custom_data', }
    })) }}

This PR adds the same possibility when using ibexa_render() :

    <h2>direct</h2>
    {{ ibexa_render(content,
        {
            'viewType': 'line',
            'method': 'direct',
            'params': {
                'my_param': 'custom_data'
            }
        })
    }} <br/>

    {{ ibexa_render(location,
        {
            'viewType': 'line',
            'method': 'direct',
            'params': {
            'my_param': 'custom_data'
        }
        })
    }} <br/>

    <h2>inline</h2>
    {{ ibexa_render(content,
        {
            'viewType': 'line',
            'method': 'inline',
            'params': {
                'my_param': 'custom_data'
            }
        })
    }} <br/>

    {{ ibexa_render(location,
        {
            'viewType': 'line',
            'method': 'inline',
            'params': {
                'my_param': 'custom_data'
            }
        })
    }} <br/>


    <h2>esi</h2>
    {{ ibexa_render(content,
        {
            'viewType': 'line',
            'method': 'esi',
            'params': {
                'my_param': 'custom_data'
            }
        })
    }} <br/>

    {{ ibexa_render(location,
        {
            'viewType': 'line',
            'method': 'esi',
            'params': {
                'my_param': 'custom_data'
            }
        })
    }} <br/>

For QA:

Documentation:

@mnocon mnocon added the Doc needed The changes require some documentation label Nov 4, 2025
@vidarl vidarl force-pushed the IBX-3035_As_a_developer_I_want_to_pass_extra_atrributes_when_using_ibexa_render_Twig_function branch 3 times, most recently from 1bb7be8 to 2a1ab1c Compare November 4, 2025 15:06
@alongosz alongosz changed the title IBX-3035 as a developer i want to pass extra atrributes when using ibexa render_twig() function IBX-3035: [Twig] Allowed passing parameters to ibexa render function Nov 5, 2025
@vidarl vidarl force-pushed the IBX-3035_As_a_developer_I_want_to_pass_extra_atrributes_when_using_ibexa_render_Twig_function branch 2 times, most recently from 099a520 to a0ddb17 Compare December 1, 2025 14:55
@vidarl vidarl requested a review from alongosz December 2, 2025 08:07
@vidarl vidarl force-pushed the IBX-3035_As_a_developer_I_want_to_pass_extra_atrributes_when_using_ibexa_render_Twig_function branch from a0ddb17 to 988d77f Compare December 2, 2025 08:10
@ibexa-yuna ibexa-yuna changed the title IBX-3035: [Twig] Allowed passing parameters to ibexa render function IBX-3035 [Twig] Allowed passing parameters to ibexa render function Dec 16, 2025
@konradoboza
Copy link
Contributor

@vidarl please make sure all the suggestions are adressed, CI lits green and the PR is rebased.

@vidarl vidarl force-pushed the IBX-3035_As_a_developer_I_want_to_pass_extra_atrributes_when_using_ibexa_render_Twig_function branch from 3c65ba0 to 5e212bb Compare December 16, 2025 13:24
@vidarl vidarl force-pushed the IBX-3035_As_a_developer_I_want_to_pass_extra_atrributes_when_using_ibexa_render_Twig_function branch from 266a88e to 00e2b90 Compare January 13, 2026 13:31
@sonarqubecloud
Copy link

@vidarl
Copy link
Contributor Author

vidarl commented Jan 14, 2026

@vidarl please make sure all the suggestions are adressed, CI lits green and the PR is rebased.

@konradoboza, @alongosz , @mikadamczyk : This is now done

Copy link
Contributor

@konradoboza konradoboza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more minor things:

Comment on lines +104 to +105
* @param \Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface|\PHPUnit\Framework\MockObject\MockObject $fragmentRendererMock
* @param \Ibexa\Contracts\Core\Repository\Values\ValueObject|\PHPUnit\Framework\MockObject\MockObject $valueObjectMock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param \Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface|\PHPUnit\Framework\MockObject\MockObject $fragmentRendererMock
* @param \Ibexa\Contracts\Core\Repository\Values\ValueObject|\PHPUnit\Framework\MockObject\MockObject $valueObjectMock
* @param \Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface&\PHPUnit\Framework\MockObject\MockObject $fragmentRendererMock
* @param \Ibexa\Contracts\Core\Repository\Values\ValueObject&\PHPUnit\Framework\MockObject\MockObject $valueObjectMock

);

/** @var \Ibexa\Contracts\Core\Repository\Values\ValueObject&\PHPUnit\Framework\MockObject\MockObject $valueObjectMock */
TestCase::assertTrue($renderContentStrategy->supports($valueObjectMock));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TestCase::assertTrue($renderContentStrategy->supports($valueObjectMock));
self::assertTrue($renderContentStrategy->supports($valueObjectMock));

/** @var \Ibexa\Contracts\Core\Repository\Values\ValueObject&\PHPUnit\Framework\MockObject\MockObject $valueObjectMock */
TestCase::assertTrue($renderContentStrategy->supports($valueObjectMock));

TestCase::assertSame(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TestCase::assertSame(
self::assertSame(

Comment on lines +57 to 58
/** @var string|null */
private $rendered;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While on it - can we have a strict type here? We hardly skip typing when introducing a new code unless there is a good reason to put mixed.

Suggested change
/** @var string|null */
private $rendered;
private ?string $rendered;


return $controllerReference->attributes['params'] === $params;
}),
self::anything(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either change the assertion or drop it entirely.

Suggested change
self::anything(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Doc needed The changes require some documentation Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants