BlockOutputCache per Block / DialogView Render adds tons of script tags


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');
        $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:

<script type="text/javascript">ConcreteAssetLoader.loadJavaScript("/concrete/js/jquery.js?ccm_nocache=ed9a5e63580412db106f31a44e83a963a7bf396c")</script>
<script type="text/javascript">ConcreteAssetLoader.loadCSS("/concrete/css/fontawesome/all.css?ccm_nocache=ed9a5e63580412db106f31a44e83a963a7bf396c")</script>
<script type="text/javascript">ConcreteAssetLoader.loadCSS("/concrete/css/cms.css?ccm_nocache=ed9a5e63580412db106f31a44e83a963a7bf396c")</script>
<script type="text/javascript">$(function() {
	ConcretePanelManager.register({'identifier': 'dashboard', 'position': 'right', url: 'http://t'

and so on....

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.

@donat it sounds like you are making some progress. What is the string mismatch?

It’s a little difficult to really understand the issue without a minimal working example. Can you elaborate on where the string mismatch is coming from?

Nah, i just had the BlockController respond with a template and hardwired a path to that method to get my template:

$this->set('stuff', $mystuff);
include('templates/news/filter_content.php'); // here i use the stuff
return $this->app->make(ResponseFactoryInterface::class)->create('');

That is esenntially what i am serving. If the block is not on a single_page, i can just have this within action_get_filter_content() and hit that to get the template. (Does not work on single pages because the url fragments are treated differently there)