# An interesting strategy for passing properties via raw template plugin outlets

**URL:** https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054
**Category:** Development
**Created:** [November 24, 2021, 11:23am UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054 "2021-11-24T11:23:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [November 24, 2021, 11:23am UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/1 "2021-11-24T11:23:33Z")

</div>

A quick question on this.

I noticed something interesting in TLT:

> <https://github.com/discourse/discourse/blob/3ea893715726c3516b3b222c77f3cc9d8ee3c1c6/app/assets/javascripts/discourse/app/templates/list/topic-list-item.hbr#L19>

There is no passing of the model here.

Yet you manage to do this:

> <https://github.com/discourse/discourse-topic-thumbnails/blob/899fe40aea8975e1d8bd0635e60801116896bda3/javascripts/discourse/connectors/topic-list-before-link/topic-thumbnail.hbr#L1>

I can only assume this is a stable strategy for passing down the model properties because it’s being employed here - any caveats?

One of the reasons I was finding these available plugin outlets less useful was because they don’t often explicitly pass down the relevant model.

Is this pattern documented anywhere? I haven’t seen it in the Ember guides …

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 24, 2021, 11:57am UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/2 "2021-11-24T11:57:45Z")

</div>

The ‘raw’ system is a discourse-specific thing, so you won’t find anything about it in the Ember guides.

> [@merefield](#):
>
> I can only assume this is a stable strategy for passing down the model properties because it’s being employed here - any caveats?

It looks like it’s pretty deliberate in the core code, so I think it’s safe to use it:

> <https://github.com/discourse/discourse/blob/fa2fd7fff85947c90d491ef4d52bfa8f3b90a28b/app/assets/javascripts/discourse/app/helpers/raw-plugin-outlet.js#L8-L8>

In fact, it doesn’t look like raw outlets have the ability to pass anything like the ‘`args`’ you find in regular plugin-outlets. So `context` is the only way to go.

> [@merefield](#):
>
> One of the reasons I was finding these available plugin outlets less useful was because they don’t often explicitly pass down the relevant model.

Please do feel free to make core PRs if you feel any useful data is missing in regular plugin outlets. Adding new arguments to outlets is relatively safe, backwards compatible, and has negligable performance impact, so it’s unlikely we’ll refuse.

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [January 18, 2022, 4:10pm UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/3 "2022-01-18T16:10:46Z")

</div>

I’ve also struggled with passing arguments through to plugin outlets. My goal has been to put a plugin outlet on a page and have the outlet get access to all the information the other component references get on that page.

I tried this in a theme component I am coding:

`{{~raw-plugin-outlet name="cool-outlet" args=(hash model=model)}}`

But get the error: `Compile Error: raw-plugin-outlet is not a helper`

Anything else I need to do to get this working?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [January 18, 2022, 4:16pm UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/4 "2022-01-18T16:16:09Z")

</div>

raw-plugin-outlet can only be used within ‘raw’ templates (those ending in `.hbr`). For regular ember templates, you should use `{{plugin-outlet ...}}`

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [January 18, 2022, 4:26pm UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/5 "2022-01-18T16:26:06Z")

</div>

EDIT: I realized the below is probably better for its own topic. I also realized that the main issue I have is importing the actions of a component into a plugin outlet. I’ve asked a question about it here:

> [@How to add a component's actions into a plugin-outlet?](https://meta.discourse.org/t/how-to-add-a-components-actions-into-a-plugin-outlet/215322):
>
> I’ve been trying to reference an existing component in a plugin-outlet, but I keep getting errors. And the main issue seems to be the actions associated with the component. Is there a proper way to reference the actions of another component in a plugin outlet? I would have thought that in a plugin-outlet, just referencing the component (ie, {{component-name action=(action "doSomething")...}}) would work to bring in all the relevant code of that component’s actions. But it seems like that is no…

* * *

Is there a simpler/standard way to successfully pass arguments into a plugin outlet?

For example:

If in a template there is the following reference to the composer-action-title component, like this:  
**composer.hbs:**

```plaintext
 {{composer-action-title
       model=model
        openComposer=(action "openComposer")
        closeComposer=(action "closeComposer")
        canWhisper=canWhisper
        tabindex=8
  }}

```

and I wanted to add a plugin outlet that–in that plugin outlet–had the same code, like:

**connectors/cool-outlet/cool-outlet.hbs:**

```plaintext
 {{composer-action-title
       model=model
        openComposer=(action "openComposer")
        closeComposer=(action "closeComposer")
        canWhisper=canWhisper
        tabindex=8
  }}

```

What do I need to do to allow my cool-outlet plugin outlet the ability to successfully reference the composer-action-title component?

Using a reference like:  
`{{plugin-outlet name="cool-outlet" args=(hash model=model)}}`  
in composer.hbs does not seem to work.
