Inside customer module layout default
vendor/magento/module-customer/view/frontend/layout/default.xml
<block class="Magento\Customer\Block\Account\AuthenticationPopup" name="authentication-popup" as="authentication-popup" template="account/authentication-popup.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="authenticationPopup" xsi:type="array">
<item name="component" xsi:type="string">Magento_Customer/js/view/authentication-popup</item>
<item name="children" xsi:type="array">
<item name="messages" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</block>
Above is form login customer will popup when customer sign in while checkout
. So my question is possible to move and add custom block to this kind of "js block" ?
Example: I want to add my block to bottom of block name "authenication-popup"
Best Answer
You can try this:
If you are doing this by separate module (make sure to add dependency to Magento_Customer in module.xml via
sequence
node) add fileapp/code/Vendor/Module/view/frontend/layout/default.xml
with the contentThen create
app/code/Vendor/Module/view/frontend/templates/account/authentication-popup.phtml
fileAnd finally create your custom block with custom template and any additional elements you need.
Then only drawback of this solution is that it is prone to conflicts if 2 modules want to do the same. In that case I would create a plugin for
Magento\Customer\Block\Account\AuthenticationPopup
class and in it prepareafterFetchView()
method and in it render the block and inject it to the result.