I have a CMS page, and in certain place it references a custom block from my module as such:
{{block class="My\Notification\Block\NotificationForm" name="notification.form" template="My_Notification::form.phtml"}}
This works and shows the template, but I don't know how to define child block within this template. In my module I have view/frontend/layout/default.xml
:
<?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>
<referenceBlock name="notification.form">
<block name="notification.form.inner" class="Magento\Framework\View\Element\Template" template="My_Notification::inner.phtml" />
</referenceBlock>
</body>
</page>
and in my form.phtml
I have
...
<?php echo $this->getChildHtml('notification.form.inner') ?>
...
but it just doesn't show up. I tried various other things, including trying to use addChild()
in my block class constructor, but no matter what I try it just doesn't show up. What am I doing wrong?