BlockController Double Instantiation?
Permalink
I've noticed that when adding a block, its controller is instantiated twice -- once from...
concrete/tools/add_block_popup.php : 7
...when being loaded and again from...
concrete/libraries/block_view.php : 197
...when being rendered.
Perhaps I'm missing some piece of the big picture, but it seems to me that the second instantiation is unnecessary because the controller is a property of the $obj being passed to the render method. Thus, it seems that $this->controller could simply be set equal to $obj->controller instead of re-instantiating it.
Is this a potential optimization (albeit a small one), or am I missing something here?
-Steve
concrete/tools/add_block_popup.php : 7
...when being loaded and again from...
concrete/libraries/block_view.php : 197
...when being rendered.
Perhaps I'm missing some piece of the big picture, but it seems to me that the second instantiation is unnecessary because the controller is a property of the $obj being passed to the render method. Thus, it seems that $this->controller could simply be set equal to $obj->controller instead of re-instantiating it.
Is this a potential optimization (albeit a small one), or am I missing something here?
-Steve
We are looking at ways to do this type of optimization in 5.5 though, so these are good suggestions. I will double check and if you see anything else of this nature we'd be interested in taking a look at it.