Extension with Actions

I noticed that a certain piece of code (model + view + controller) is used in more than one place accross my application.

This piece of code shows a subscreen with some handling actions.

My first approach was to abstract this information and put it in a base class, but that is not so nice I think.

Better would be to use another approach whereby the model, view and controller are combined into a package.

I tried using widgets, but I cannot get actions to be called inside the widget section

I tried common sub_views, but then I still need the action to be in the abstraction

Any other suggestions ?

http://www.yiiframework.com/doc-2.0/guide-structure-modules.html

Thanks. . I am a bit familiar with modules. … but what I do not know yet is how to render module b views and have those views handle module b controller code within the view of module A

I can render another view but when I render module b view in module a it uses module A controller … and I want to separate the code in the controller for reuse

So I want to render module b view in module a view AND use module B controller for module b views

Any ideas how this include looks like in code?

After puzzling and studing kartik’s grid I was able to fix this by adding actions to the grid. If someone is interested I will post the solution