cancel
Showing results for 
Search instead for 
Did you mean: 

custom widget in custom page footer

custom widget in custom page footer

looking for some help. I have created a custom page with url:

http://localhost/magento2/hello_mvvm/hello/world

and there is view/frontend/layout/hello_mvvm_hello_world.xml code:

 <?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="content">
        <block
                template="content.phtml"
                class="Pulsestorm\HelloWorldMVVM\Block\Main"
                name="pulsestorm_helloworld_mvvm"/>
    </referenceBlock>
</page>

some how I need to add my custom created widget to my custom created above mentioned page in the footer container place, can some one assist me?

My custom widget placed in app/code/Toptal/CustomWidget

2 REPLIES 2

Re: custom widget in custom page footer

You need to set referenceContainer as Footer-container for keep your widget in footer section,

 <?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="footer-container">
        <block
                template="content.phtml"
                class="Pulsestorm\HelloWorldMVVM\Block\Main"
                name="pulsestorm_helloworld_mvvm"/>
    </referenceContainer>
</page>
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: custom widget in custom page footer

 Hello, thanks for you reply, but I need to add a custom widget, with template name

simplewidget.phtml

, class then should be I think : 

Toptal\CustomWidget\Block\Widget\Samplewidget

But I dont now name of this block, how to get it? My code looks now:

 

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="content">
        <block
                template="content.phtml"
                class="Pulsestorm\HelloWorldMVVM\Block\Main"
                name="pulsestorm_helloworld_mvvm"/>
    </referenceBlock>
    <referenceContainer name="footer-container">
        <block
                template="samplewidget.phtml"
                class="Toptal\CustomWidget\Block\Widget\Samplewidget"
                name=""/>
    </referenceContainer>
</page>