I am trying to override contact us page from one column to 2-columns-left
what I have did is copy contact_index_index.xml from vendor\magento\module-contact\view\frontend\layout\
to
app\design\frontend\namespace\themename\Magento_Contact\layout\
and change layout to layout="2columns-left" so my xml is like bellow
<?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <title>Contact Us</title> </head> <body> <referenceContainer name="content"> <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"> <container name="form.additional.info" label="Form Additional Info"/> </block> </referenceContainer> </body> </page>
everything working fine and it changes template to 2 columns left but some how captcha is not rendering. Is it bug or I am doing something wrong ?
2 Answers 2
Anyway I have solved it myself.The captcha is not rendering due to I haven't override captcha layout xml so overriding it to your theme will solved issue.
I had the same problem and just overriding the captcha layout it was solved. Just what you said. For more help, my code is
<referenceContainer name="content">
<block class="Entrepids\Contact\Block\ContactForm" name="contactForm" template="Entrepids_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
<referenceContainer name="form.additional.info">
<block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false">
<action method="setFormId">
<argument name="formId" xsi:type="string">contact_us</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>
</referenceContainer>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/>
</referenceBlock>
-
Nice! That solved my problem with the captcha not showingJustinP– JustinP2018年10月23日 02:06:19 +00:00Commented Oct 23, 2018 at 2:06