carlcs / craft-twigportal
Twig Portal plugin for Craft CMS
Installs: 613
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 0
Open Issues: 1
Type:craft-plugin
Requires
- craftcms/cms: ^4.0.0-beta.1
This package is auto-updated.
Last update: 2024-11-08 22:57:23 UTC
README
Warning
This plugin has been abandoned. With the release of Craft 4.5, the _globals
Twig variable has been added, rendering this plugin obsolete. The functionality it provided can now be achieved using the new variable.
Twig Portal plugin for Craft CMS
Adds a portal tag to Twig, to render DOM anywhere in the document.
Installation
Twig Portal is available in the Plugin Store. You can also install the plugin manually from the command line with the following commands.
composer require carlcs/craft-twigportal
php craft plugin/install twig-portal
Usage
_layout.html
<body> {% block content %} {% endblock %} {{ portalTarget('modals') }} </body>
index.html
{% extends '_layout' %} {% block content %} {{ include('_component') }} {% endblock %}
_component.html
{% portal 'modals' %} <p>This will be rendered where the “modals” portal target function is located.</p> {% endportal %}