3

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?

2 Answers 2

2

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

1
  • spot on you are right I do have a number in my vendor I've applied the fix from the link github.com/Mobecls/magento2/commit/… ... <xs:restriction base="xs:string"> <xs:pattern value="[a-zA-Z_]+" /> //remove <xs:pattern value="[a-zA-Z0-9_]+" />//added </xs:restriction> ... Commented Jun 5, 2019 at 9:22
1

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
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.