typoscript_rendering icon indicating copy to clipboard operation
typoscript_rendering copied to clipboard

V12 undefined method getPluginName using t:uri.cObject

Open simouel opened this issue 1 year ago • 0 comments

Hi, we are getting this error using t:uri.cObject using the V12 branch.

Call to undefined method TYPO3\CMS\Core\Http\ServerRequest::getPluginName()Call to undefined method TYPO3\CMS\Core\Http\ServerRequest::getPluginName()
<t:uri.cObject pageUid="24" typoscriptObjectPath="lib.menuUser"/>

To 'dirty' fix this, we've added 3 lines to the renderStatic

public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        $arguments['pluginName'] = 'Dummy';
        $arguments['extensionName'] = 'Dymmy';
        $arguments['controller'] = 'Dummy';
        $uri = (new TyposcriptRenderingUri())->withViewHelperContext(
            new ViewHelperContext(
                $renderingContext,
                $arguments
            )
        );        return (string)$uri;
    }

and we changed our fluid code:

<t:uri.cObject contextRecord="page:24" pageUid="24" typoscriptObjectPath="lib.menuUser"/>

Is there a better way to fix that. Are we using it wrong ? Our lib.menuUser is a COA_INT

This "fix" was inspired by https://github.com/helhum/typoscript_rendering/pull/76

We are open to making a PR based on suggestion Thank you :)

simouel avatar Sep 27 '24 14:09 simouel