View Render Event
-
Question.
How can i pass data in when i add new template in an event. I need an array of data for select input.
eg.Event::listen('bagisto.admin.catalog.product.edit_form_accordian.General.controls.after', function($viewRenderEventManager) { $viewRenderEventManager->addTemplate('xxx::xx.xx.xx',compact(''data)); });
-
Hi @jimbodev ,
As I am seeing your code, I want to tell you that the
$viewRenderEventManager->addTemplate()
the method will take only one argument as a parameter which is the location of the template.
So your code will look like this,
Event::listen('bagisto.admin.catalog.product.edit_form_accordian.General.controls.after', function($viewRenderEventManager) { $viewRenderEventManager->addTemplate('xxx::xx.xx.xx'); });
Now if you want to pass the data then you need to use
{{ view_render_event('bagisto.admin.catalog.product.edit_form_accordian.General.controls.after', compact('data')) }}
in the main blade file.