I made a custom module block with the following layout:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Form Partner</title>
</head>
<body>
<referenceContainer name="content">
<block class="MyvendornameMymodulenameBlockCaptchaForm" name="contactForm" template="Myvendorname_Mymodulename::captchaform.phtml">
<container name="form.additional.info" as="form.additional.info" label="Form Additional Info">
<block class="MagentoCaptchaBlockCaptcha" name="captcha" after="-" cacheable="false">
<action method="setFormId">
<argument name="formId" xsi:type="string">custom_form</argument>
</action>
<action method="setImgWidth">
<argument name="width" xsi:type="string">230</argument>
</action>
<action method="setImgHeight">
<argument name="width" xsi:type="string">50</argument>
</action>
</block>
</container>
</block>
</referenceContainer>
<referenceBlock name="head.components">
<block class="MagentoFrameworkViewElementJsComponents" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/>
</referenceBlock>
</body>
</page>
In the template file, at a point, I have:
<?php echo $this->getBlockHtml('captcha'); ?>
When I visit the module route on my browser the captcha block is shown but when call the block in a CMS page with this code
{{block class="MyvendornameMymodulenameBlockCaptchaForm" template="Myvendorname_Mymodulename::captchaform.phtml"}}
then I see all the main block elements but not the child block… It is not loaded.
I already tried various combinations, e.g. called the container form.additional.info with getChildHtml but it always work only visiting directly the module and it fails when I call the block in a CMS page.