Answer the question
In order to leave comments, you need to log in
How to add a block without changing the name of the xml file in Magento?
I have a file \Gleb\Test1\view\frontend\layout\default.xml and I need to add a block there.
But no matter how much I try, the page does not change.
Module code: https://github.com/GreatGleb/module_in_magento2
Here is the code of this file:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Gleb_Test1::css/custom.css" />
</head>
<body>
<referenceBlock name="form.subscribe">
<block class="Gleb\Test1\Controller\Block\Name" name="newsletter.name" before="-" template="Gleb_Test1::name.phtml" />
</referenceBlock>
<move element="form.subscribe" destination="header-wrapper" after="-" />
</body>
</page>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question