• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

viewRenderEventManager add template with params

Knowledge Base
2
3
647
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.
  • V
    Vlad99 last edited by 15 Jul 2020, 15:20

    How can I inject a view using the Events listeners, and viewRenderEventManager but with some dynamic parameters?
    Something like:
    Event::listen('bagisto.shop.layout.head', function ($viewRenderEventManager) {
    $viewRenderEventManager->addTemplate('gtmanager::gtm.head', ['param1' => $param]);
    });

    So I need to insert the view ('gtmanager::gtm.head') from my custom module in the 'bagisto.shop.layout.head' location with the parameter 'param1'

    Any idea how can I achieve something like this?

    Thanks!

    1 Reply Last reply Reply Quote 0
    • N
      Naresh-webkul last edited by 16 Jul 2020, 13:40

      Hello @Vlad99 ,
      You can use the view->composer() in your service provider to pass any parameter to the blade where this view_render_event(bagisto.shop.layout.head) is already defined, after that inject your template and you can access the parameter in template that you have passed in viewComposer.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • N
        Naresh-webkul last edited by 16 Jul 2020, 13:41

        You can check the AdminServiceProvider under The Admin Package for the reference.

        1 Reply Last reply Reply Quote 0
        2 out of 3
        • First post
          2/3
          Last post