I have a Block that generates a List for a Filter via a DialogView. That view is then applied via js to a filtering Sidebar. On one occasion it ran flawlessly, on another location (other items to filter) the output of the DialogView’s render() has a lot of script tags in it and they fail.
This is what i use in my BlockControllers constructor: ($locations + $divisions are used inside the filter_content to dynamically render the list)
$view = new DialogView('templates/employee_grid/filter_content'); $view->setViewRootDirectoryName('blocks/employee_grid'); $view->setPackageHandle('package'); $view->setController($this); $this->set('locations', $locations); $this->set('divisions', $divisions); $filterContent = $view->render();
Now the actual content of the filter_content file does not matter. The output in one case is like this:
I expect the $filterContent to be just the content of the template i set (and that works in another place) and i do not know why all the script tags are inserted. I also can not spot the difference between the two blocks.
Note that all this is from a visitor, not a logged-in User. Also for visitors, the site runs wihtout jQuery so i do not know where this is coming from.
Any help is appreciated.
Edit: The Problem only appears if i turn on “Block Output Cache” in concrete Settings. If it is turned on, i can manually overwrite the cacheBlockOutput() method to return false or set the Cache options via Edit → Advanced but that gives me the exact same results.
Edit2: I got the difference. The working one is rendered on a SinglePage and the broken one is rendered on a “normal” page and therefore the RequestInstance requires some assets. I can not overwrite that (setRequestInstance() is protected) so i am looking for another solution. Maybe i just need to fix the string mismatch.