Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support Magewire in the backend #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,62 @@
</argument>
</arguments>
</type>

<type name="Magewirephp\Magewire\Model\ComponentManager">
<arguments>
<argument name="updateActionsPool" xsi:type="array">
<item name="callMethod" xsi:type="object">Magewirephp\Magewire\Model\Action\CallMethod</item>
<item name="fireEvent" xsi:type="object">Magewirephp\Magewire\Model\Action\FireEvent</item>
<item name="syncInput" xsi:type="object">Magewirephp\Magewire\Model\Action\SyncInput</item>
</argument>
</arguments>

<!-- Execute lifecycle methods -->
<plugin name="Magewirephp_Magewire_Plugin_Model_ComponentManager"
type="Magewirephp\Magewire\Plugin\Model\ComponentManager"
sortOrder="50"/>
</type>

<type name="Magewirephp\Magewire\Model\Action\CallMethod">
<arguments>
<!-- Define public methods as protected to avoid being called on a subsequent request -->
<argument name="uncallableMethods" xsi:type="array">
<!-- Lifecycle -->
<item name="10" xsi:type="string">mount</item>
<item name="11" xsi:type="string">hydrate</item>
<item name="12" xsi:type="string">dehydrate</item>
<item name="13" xsi:type="string">updating</item>
<item name="14" xsi:type="string">updated</item>

<!-- Base Component -->
<item name="15" xsi:type="string">getParent</item>
<item name="16" xsi:type="string">setParent</item>
<item name="17" xsi:type="string">getPublicProperties</item>
<item name="18" xsi:type="string">__call</item>

<!-- Concerns -->
<item name="19" xsi:type="string">setRequest</item>
<item name="20" xsi:type="string">getRequest</item>
<item name="21" xsi:type="string">setResponse</item>
<item name="22" xsi:type="string">getResponse</item>
<item name="23" xsi:type="string">getEventQueue</item>
<item name="24" xsi:type="string">getUncallables</item>

<!-- Pagination -->
<item name="26" xsi:type="string">renderPagination</item>

<item name="27" xsi:type="string">fill</item>
<item name="28" xsi:type="string">reset</item>

<!-- Forms -->
<item name="29" xsi:type="string">validate</item>
</argument>
</arguments>
</type>

<type name="Magento\Framework\View\TemplateEngine\Php">
<!-- Automatically assign $magewire as template Block variable -->
<plugin name="Magewirephp_Magewire_Plugin_Magento_Framework_View_TemplateEngine_Php"
type="Magewirephp\Magewire\Plugin\Magento\Framework\View\TemplateEngine\Php"/>
</type>
</config>
18 changes: 18 additions & 0 deletions src/etc/events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"
>
<event name="view_block_abstract_to_html_before">
<!-- As close as possible before rendering -->
<observer name="MagewirephpMagewireViewBlockAbstractToHtmlBefore"
instance="Magewirephp\Magewire\Observer\Frontend\ViewBlockAbstractToHtmlBefore"
/>
</event>

<event name="view_block_abstract_to_html_after">
<!-- As close as possible after rendering -->
<observer name="MagewirephpMagewireViewBlockAbstractToHtmlAfter"
instance="Magewirephp\Magewire\Observer\Frontend\ViewBlockAbstractToHtmlAfter"
/>
</event>
</config>
62 changes: 0 additions & 62 deletions src/etc/frontend/di.xml

This file was deleted.

14 changes: 0 additions & 14 deletions src/etc/frontend/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"
>
<event name="view_block_abstract_to_html_before">
<!-- As close as possible before rendering -->
<observer name="MagewirephpMagewireViewBlockAbstractToHtmlBefore"
instance="Magewirephp\Magewire\Observer\Frontend\ViewBlockAbstractToHtmlBefore"
/>
</event>

<event name="view_block_abstract_to_html_after">
<!-- As close as possible after rendering -->
<observer name="MagewirephpMagewireViewBlockAbstractToHtmlAfter"
instance="Magewirephp\Magewire\Observer\Frontend\ViewBlockAbstractToHtmlAfter"
/>
</event>

<event name="hyva_config_generate_before">
<!-- Hyvä Themes compatibility: Registering a module for inclusion in hyva-themes.json -->
<!-- @see https://docs.hyva.io/hyva-themes/compatibility-modules/tailwind-config-merging.html -->
Expand Down
72 changes: 72 additions & 0 deletions src/view/base/layout/default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<body>
<referenceContainer name="before.body.end">
<!-- <block name="magewire.livewire"-->
<!-- before="script-alpine-js"-->
<!-- template="Magewirephp_Magewire::page/js/magewire-livewire.phtml">-->
<!-- <arguments>-->
<!-- <argument name="view_model" xsi:type="object">-->
<!-- Magewirephp\Magewire\ViewModel\Magewire-->
<!-- </argument>-->
<!-- </arguments>-->
<!-- </block>-->

<!-- <block name="magewire.initialize"-->
<!-- after="magewire.livewire"-->
<!-- template="Magewirephp_Magewire::page/js/magewire-initialize.phtml"-->
<!-- >-->
<!-- <arguments>-->
<!-- <argument name="view_model" xsi:type="object">-->
<!-- Magewirephp\Magewire\ViewModel\Magewire-->
<!-- </argument>-->
<!-- </arguments>-->

<!-- <container name="magewire.plugin.scripts" as="magewire.plugins">-->
<!-- &lt;!&ndash; Inject the Magewire core Loader plugin &ndash;&gt;-->
<!-- <block name="magewire.plugin.loader"-->
<!-- ifconfig="dev/magewire/loader/enable"-->
<!-- template="Magewirephp_Magewire::page/js/magewire/plugin/loader.phtml">-->
<!-- <arguments>-->
<!-- <argument name="view_model" xsi:type="object">-->
<!-- Magewirephp\Magewire\ViewModel\Magewire-->
<!-- </argument>-->
<!-- </arguments>-->
<!-- </block>-->

<!-- <block name="magewire.plugin.error"-->
<!-- template="Magewirephp_Magewire::page/js/magewire/plugin/error.phtml"-->
<!-- >-->
<!-- <arguments>-->
<!-- <argument name="view_model" xsi:type="object">-->
<!-- Magewirephp\Magewire\ViewModel\Magewire-->
<!-- </argument>-->

<!-- &lt;!&ndash; Specify specific messages for each HTTP status code. &ndash;&gt;-->
<!-- <argument name="status_messages" xsi:type="array">-->
<!-- <item name="419" xsi:type="string">-->
<!-- The session has expired. Therefore, the page will be refreshed when you confirm.-->
<!-- </item>-->
<!-- </argument>-->
<!-- </arguments>-->
<!-- </block>-->
<!-- </container>-->

<!-- <container name="magewire.directive.scripts" as="magewire.directives">-->
<!-- <block name="magewire.directive.select"-->
<!-- template="Magewirephp_Magewire::page/js/magewire/directive/select.phtml"/>-->
<!-- </container>-->

<!-- <container name="magewire.extend.scripts" as="magewire.extends">-->
<!-- <block name="magewire.extend.plugin"-->
<!-- template="Magewirephp_Magewire::page/js/magewire/extend/plugin.phtml"/>-->
<!-- </container>-->
<!-- </block>-->
</referenceContainer>

<!-- Global Magewire pager placeholder -->
<block name="magewire.pagination.pager"/>
</body>
</page>
File renamed without changes.