I want to display static block in html login popup during checkout, but there is a problem.
This is the html template which is called from js, this js is called from phtml, and this phtml template called from xml layout. ( xml -> phtml -> js -> html)
So the question is how to send custom content block from the phtml or xml throught js to html template
vendor/magento/module-catalog/view/frontend/layout/default.xml
This file is calling pthml template with
<block class="Magento\Customer\Block\Account\AuthenticationPopup" name="authentication-popup" as="authentication-popup" template="Magento_Customer::account/authentication-popup.phtml"> vendor/magento/module-customer/view/frontend/templates/account/authentication-popup.phtml
This file is calling js layout with code:
<script type="text/x-magento-init"> { "#authenticationPopup": { "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> vendor/magento/module-customer/view/frontend/web/js/view/authentication-popup.js
this file is called the last html template where should be a static block from admin panel, with code:
define([ 'jquery', 'ko', // ......... // ], function ($, ko, /* ... ... ... .... ... */) { 'use strict'; return Component.extend({ registerUrl: window.authenticationPopup.customerRegisterUrl, forgotPasswordUrl: window.authenticationPopup.customerForgotPasswordUrl, autocomplete: window.authenticationPopup.autocomplete, modalWindow: null, isLoading: ko.observable(false), defaults: { template: 'Magento_Customer/authentication-popup' }, }); }); this is how i get this block in php
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('reset_password_notice')->toHtml(); ?> I tried to paste it to phtml, it doesn't work !!!