Where to add header items for block?

Permalink
Where is the _right_place_ to insert addHeaderItem() calls to include stuff that _only_ my block's _view_ will require?

Where is the _right_place_ to insert addHeaderItem() calls to include stuff that _only_ my block's _editor_ will require?

 
andrew replied on at Permalink Reply
andrew
Define a function named on_page_view() in your block's controller, and call $this->addHeaderItem() within it.
Rushing replied on at Permalink Reply
Are there plans to tweak the order of operations or create a way to add the assets directly from the block views? I've run into this a couple of times.

There's no way to do this when creating a custom template for a core/package block type without overriding the controller. So, you either have to obscure the upgrade path by overriding an important file, or echo the script tag directly in the block view, which I think is messy.
htarlov replied on at Permalink Reply
htarlov
I have the same issue too. And it's even worse with CSS files. It would be great if one could add them from block level but without overriding controller (it could be from view but it also could be from some other file that would define it).
nerdess replied on at Permalink Reply
nerdess
I find it odd that I can add e.g. css to the header with

$this-addHeaderItem()


in on_page_view() but not inside view() or am I missing something here?