2

I have a Custom Page, on that I had Hide the Header and Footer. But i need a Language Switcher in my custom Page. I had tried like this below on my Layout XML file,

<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>

My full Layout Xml File is below,

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"layout="1column"xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <css src="St_CustomMultiseller::css/customregister.css"/>
</head>
<body>  
  <referenceBlock name="header.content" remove="true" />
  <referenceContainer name="footer-container" remove="true"/>
  <referenceBlock name="page.main.title" remove="true" /> 
   <referenceBlock name="vendor_create_form" remove="true"/>
  <referenceBlock name="vendor.create">
       <action method="setTemplate">
             <argument name="template" xsi:type="string">St_CustomMultiseller::account/create.phtml </argument>       
       </action>
       <block class="\VendorsCustomRegister\Block\Account\Create\Vendor" name="new_vendor_create_form" template="St_CustomMultiseller::account/create/vendor-form.phtml"/>
       <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>
  </referenceBlock>

</body>

But it not comes. Anyone help me to get the Language Switcher on my custom page.

3 Answers 3

0

I had get a Store Switcher by using the <move> tag to move the language switcher to my custom block and changed my Layout xml file like below,

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"layout="1column"xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="St_CustomMultiseller::css/customregister.css"/>
</head>
<body>  
<referenceBlock name="header.content" remove="true" />
<move element="store_language" destination="vendor.create" />
<referenceContainer name="footer-container" remove="true"/>
<referenceBlock name="page.main.title" remove="true" /> 
<referenceBlock name="vendor_create_form" remove="true"/>
<referenceBlock name="vendor.create">
   <action method="setTemplate">
         <argument name="template" 
 xsi:type="string">St_CustomMultiseller::account/create.phtml </argument>       
   </action>
   <block class="\VendorsCustomRegister\Block\Account\Create\Vendor" name="new_vendor_create_form" template="St_CustomMultiseller::account/create/vendor-form.phtml"/>

   </referenceBlock>
   </body>
0

To show the element in your phtml file, you have to add the following code to your phtml file

<?php $block->getChildHtml('store_language');?>
1
  • Hi, thanks for responding. i had done that already bro.
    – Ask Xah
    Commented Jul 22, 2019 at 11:42
-1

Directly Put below code in .phtml file

enter image description here

1
  • wtf dude, an image???
    – Ansyori
    Commented May 22 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.