action method not available a rendered block
Permalink
I render a block
$bt = BlockType::getByHandle('my_block');
$bt->render('view');
but in the block's view the action method seems unavailable, so this is empty
$this->action('any_action')
$bt = BlockType::getByHandle('my_block');
$bt->render('view');
but in the block's view the action method seems unavailable, so this is empty
$this->action('any_action')
![JohntheFish](/files/avatars/51576.jpg)
At a guess (I am by no means sure of this), you are rendering the view of a block type, not an instance of a block. So there is no actual block object for the action to be associated with.
Correct, I'm rendering a view of a block type. So if the action method is associated only with a view of an instance of a block how can I access a method of the controller?
In my case it's a form, so in view I'd like to render the action attribute of the form that corresponds to a action_validate method in the controller.
I've seen people do it with file in the tools dir
In my case it's a form, so in view I'd like to render the action attribute of the form that corresponds to a action_validate method in the controller.
I've seen people do it with file in the tools dir