magesuite / theme-creativeshop

Open Software License 3.0
38 stars 23 forks source link

Remove disallowed display attribute #92

Closed fritzmg closed 3 years ago

fritzmg commented 3 years ago

Currently the following error occurs (in developer mode) in Magento 2.4.3:

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'display': The attribute 'display' is not allowed.
Line: 2804

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'display': The attribute 'display' is not allowed.
Line: 2804

<pre>#1 Magento\Framework\Config\Dom->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
#2 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]
#3 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#4 Magento\Framework\ObjectManager\ObjectManager->create() called at [vendor/magento/framework/Config/DomFactory.php:43]
#5 Magento\Framework\Config\DomFactory->createDom() called at [vendor/magento/framework/View/Model/Layout/Update/Validator.php:141]
#6 Magento\Framework\View\Model\Layout\Update\Validator->isValid() called at [vendor/magento/framework/View/Model/Layout/Merge.php:524]
#7 Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout() called at [vendor/magento/framework/View/Model/Layout/Merge.php:500]
#8 Magento\Framework\View\Model\Layout\Merge->load() called at [generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php:149]
#9 Magento\Framework\View\Model\Layout\Merge\Interceptor->load() called at [vendor/magento/framework/View/Layout/Builder.php:86]
#10 Magento\Framework\View\Layout\Builder->loadLayoutUpdates() called at [vendor/magento/framework/View/Layout/Builder.php:63]
#11 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Page/Config.php:224]
#12 Magento\Framework\View\Page\Config->build() called at [vendor/magento/framework/View/Page/Config.php:587]
#13 Magento\Framework\View\Page\Config->getElementAttribute() called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:248]
#14 Magento\Framework\View\Page\Config\Interceptor->getElementAttribute() called at [vendor/magento/framework/View/Page/Config.php:545]
#15 Magento\Framework\View\Page\Config->addBodyClass() called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:230]
#16 Magento\Framework\View\Page\Config\Interceptor->addBodyClass() called at [vendor/magento/module-catalog/Controller/Category/View.php:249]
#17 Magento\Catalog\Controller\Category\View->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
…

The display attribute is not allowed on the <block> element in layout files. It is only allowed for <referenceContainer> or <referenceBlock>.

I am not sure what the original purpose of display="false" for this particular block was though.

tim-breitenstein-it commented 3 years ago

If I remove the snippet: display="false" the Go to top icon is alwas displayed at the page bottom.

tim-breitenstein-it commented 3 years ago

vendor\magento\framework\View\Layout\etc\elements.xsd

Line 218:

+        <xs:attribute type="xs:string" name="display" use="optional" />
fritzmg commented 3 years ago

If I remove the snippet: display="false" the Go to top icon is alwas displayed at the page bottom.

True. And it seems to be without any styles in the current version of the theme.

vendor\magento\framework\View\Layout\etc\elements.xsd

Line 218:

+        <xs:attribute type="xs:string" name="display" use="optional" />

Well that can hardly be the solution? Adjusting the Magento core files?

tim-breitenstein-it commented 3 years ago

Well that can hardly be the solution? Adjusting the Magento core files?

Look here, same thing:

https://github.com/magesuite/theme-creativeshop/issues/2

https://github.com/magento/magento2/commit/f8d88d65a716854be69c1f155884a30e89cba160

Still not working in Magento 2.4.3 ...

https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd#L331

vs:

https://github.com/magento/magento2/blob/2.4.3/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd#L331

fritzmg commented 3 years ago

Yeah, that was a bug which is now fixed in Magento. But the display attribute seems to be intended to not be used on regular <block> elements. Only on <referenceBlock> or <referenceContainer>. If you think this is not intended, then an issue needs to be raised in the Magento repository.

msiewierska commented 3 years ago

With tag v15.1.8 we remove the unnecessary page.scroll blocks. This component is now optional.

To display scroll to top component please add to proper layout in your child theme. To receive style add import 'components/page-scroll'; to proper entires files.

Thank you for reporting this issue.