Question

I have a custom section tab in configuration my section url is: http://dev.test/admin/admin/system_config/edit/section/vendor_module/key/?????????

exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid XML in file .../app/code/Vendor/Module/etc/adminhtml/events.xml:
Element 'event', attribute 'name': [facet 'pattern'] The value 'admin_system_config_changed_section_vendor_module' is not accepted by the pattern '[a-zA-Z_]+'.
Line: 3

Element 'event', attribute 'name': 'admin_system_config_changed_section_vendor_module' is not a valid value of the atomic type 'eventName'.
Line: 3

Element 'event', attribute 'name': Warning: No precomputed value 
available, the value was either invalid or something strange happend.
Line: 3
...

events.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="admin_system_config_changed_section_vendor_module">
    <observer name="custom_admin_system_config_change_vendor_module" instance="Vendor\Module\Observer\ConfigObserver"/>
</event>
</config>

It works with general and other sections. Any ideas?

Was it helpful?

Solution

I think is related with bug and your vendor or module have number in name. Like 'b2b' or something.

Solution is to change names with this numbers or upgrade to Magento 2.3

Ref. https://github.com/magento/magento2/issues/5035enter link description here

OTHER TIPS

I cant see any issue with that XML

Compare it with this

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="custom_admin_system_config_change_vendor_module">
        <observer instance="Xigen\Config\Observer\Backend\Custom\AdminSystemConfigChangeVendorModule" name="xigen_config_observer_backend_custom_adminsystemconfigchangevendormodule_custom_admin_system_config_change_vendor_module"/>
    </event>
</config>

AdminSystemConfigChangeVendorModule.php

namespace Xigen\Config\Observer\Backend\Custom;

class AdminSystemConfigChangeVendorModule implements \Magento\Framework\Event\ObserverInterface
{
    /**
     * Execute observer
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    public function execute(
        \Magento\Framework\Event\Observer $observer
    ) {
        //Your observer code
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top