# Converting modals from legacy controllers to new DModal component API

**URL:** https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057
**Category:** Developer Guides
**Tags:** code
**Created:** [July 3, 2023, 9:52am UTC](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057 "2023-07-03T09:52:14Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [November 7, 2023, 5:05pm UTC](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057/15 "2023-11-07T17:05:46Z")

</div>

Depending on what you need to modify, I think the best solution would be to use a [`PluginOutlet`](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727) to inject your custom code, or a [`PluginOutlet` Wrapper](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727#wrapper-outlets-2) to replace/conditionally show the core implementation. (You can PR to add an outlet if its not available)

If you really want to use `modifyClass` it should be still possible, it’s just that the modal is a component now and its nested in `components/modal` so you would access it like:

```js
api.modifyClass("component:modal/poll-ui-builder", {
   pluginId: "your-custom-plugin-id",

   // insert custom code
});
```

---

_[View the full topic](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057)._
