My custom module xml file contains the block code. I want to call that block code directly using createBlock method and set template to show in specific template. My block code is adding animated fancing lines to form.
If i mention in xml using following format then it works fine. How can i display same block using createBlock method?
<referenceContainer name="form.contact.additional.info">
<block class="Jackson\Wyss\Block\Frontend\Wyss" name="Wyss-reca" after="-"
template="Jackson_Wyss::wyss.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="wyssdata" xsi:type="array">
<item name="component" xsi:type="string">Jackson_Wyss/js/reca</item>
<item name="zone" xsi:type="string">contact</item>
</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
for example:
$block->getLayout()->createBlock('Jackson\wyss\Block\Frontend\Reca')->setData('jsLayout', '5')->setTemplate('goodtest/test.phtml')->toHtml();
In above xml code zone is form type name. I want to set different name for all the forms in createBlock method. is there anyway we can createBlock method for above xml code?
How can i make createBlock method of my above xml code?