I need to pass the customer object from the edit.phtml template to a child template:
I have this but it does not work:
<?php $block->getChildBlock('form_additional_info')->setData('customer', $block->getCustomer()); echo $block->getChildHtml('form_additional_info', false); ?> Error is PHP Fatal error: Uncaught Error: Call to a member function setData() on bool
Any help?
EDIT:
This is the customer_account_edit.xml file:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <update handle="customer_account"/> <body> <referenceContainer name="content"> <block class="Magento\Customer\Block\Form\Edit" name="customer_edit" template="MyExtension_Core::customer/form/edit.phtml" cacheable="false"> <container name="form.additional.info" as="form_additional_info"/> </block> <referenceContainer name="form.additional.info"> <block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="MyExtension_Core::customer/additionalinfocustomer.phtml"/> </referenceContainer> </referenceContainer> </body> </page>