Is there a way to access partials from another component or another plugin?
I have a modal component showing some sort of message. Now I have another component showing a complex form in a modal dialog. They reside in 2 plugins.
Is there a way to access partials from another component or another plugin?
I have a modal component showing some sort of message. Now I have another component showing a complex form in a modal dialog. They reside in 2 plugins.
Copyright © 2021 Jogjafile Inc.
Yes, inside of a plugin component you can access partials from both another component in the same plugin (you'd setup a shared partial), and components and partials from other plugins.
For accessing shared partials between components in the same plugin, see this section of the docs.:
For accessing components or partials from another plugin inside of your component plugin, see the following examples of the
FooandBarplugins:plugins/montanabanana/foo/Plugin.php:plugins/montanabanana/foo/components/Thud.phpplugins/montanabanana/foo/components/thud/default.htmplugins/montanabanana/foo/components/thud/partial.htmOk, so we have setup the Foo plugin that registers a Thud component. That component has some basic default markup in it as well as a partial in the component folder. Now, let's setup another plugin that has a component
Gruntwhich can use this component and partialThudfromFoo:plugins/montanabanana/bar/Plugin.phpplugins/montanabanana/bar/components/grunt/default.htmNote that in the above component default markup file for the Grunt component in Bar, we have called both the Thud component and the
partial.htmpartial from the Thud component.We're not quite done though, and I am pretty sure it has to be done this way (though there may be a more elegant way I don't know about), but we have define both components on the page we want to call this all from:
themes/your-theme/pages/example.htmThe output of which is:
I don't fully understand what you're asking in the second part of your question, but hopefully the above helps you solve it.