Skip to content

Is there a way to add PHP template name support for custom render function? #1704

Open
@Anubarak

Description

@Anubarak

Sorry for the incredible bad title.. and thank you very much for your great plugin, it really helps me.
One thing I was looking for is the following:

My Controller

// works...
public function myFunction()
{
    $this->view->render('template-path.twig, ['var1' => 1]);
}

pressing CTRL enables me to jump right to the template and all variables in the template are available in PHPStorm
image
image

I would like to create a custom wrapper for this

public function myCustomTemplateRenderFunction(string $templateName, array $variables = [])
{
    // do some stuff, proceed the templateName and variables... custom logic here...

    return $this->view->render('calculations/' . $templateName . '.twig', $variables);
}

// .....
// automatically jumping to the template or variable suggestions is not possible here anymore
$this->myCustomTemplateRenderFunction('test', ['var1' => 1]);

So my question is: is there any possible way (via PHPDoc, Plugin Settings injection or whatever) to tell PHPStorm myCustomTemplateRenderFunction actually calls a render function with a certain path in the end?

Thank you very much.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions