Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    View Render Event

    General Discussion
    2
    2
    317
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jimbodev last edited by

      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));
          });
      
      1 Reply Last reply Reply Quote 0
      • devansh-webkul
        devansh-webkul last edited by devansh-webkul

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post