0

I have created one extension it is not working in my custom magento application(2.2.4) but it is working fine in default magento2.2.4.

I am getting error because of below code defaul.xml code:

<head>        
<block class="HK\Hplus\Block\CheckIframe" name="hplus_checkiframe" template="HK_Hplus::checkiframe.phtml"/>
</head>

============

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ). Line: 715

When i run my page it is throwing above error I have disabled all third party extension still getting this issue. Same extension working fine in native magento.

  • You cannot add block to your head block on this way. – Sukumar Gorai Jul 9 '18 at 12:04
  • @SukumarGorai it is working fine in default magento 2.2.4 so i don't think that is the reason. – user69071 Jul 9 '18 at 12:06
  • In default magento did you use the same code on default.xml? – Sukumar Gorai Jul 9 '18 at 12:08
4

You cannot add block to your head block in this way. If you want to add then you can use the below code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="head.additional">
            <block class="HK\Hplus\Block\CheckIframe" name="hplus_checkiframe" template="HK_Hplus::checkiframe.phtml" />
        </referenceBlock>
    </body>
</page>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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