That seems a bit complicated. I dont know if what you describe is possible. But could you for example have 2 variables ? One for the view that will be a string and one other that will be an array that you'll pass to your template. Something like this.