0

I have a custom observer for admin admin_system_config_changed_section_{{$section_name}} the following are:

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_section_name">
    <observer name="custom_admin_system_config_change_section_name" instance="Vendor\Module\Observer\ConfigObserver"/>
</event>
</config>

Where section_name in system.xml:

...<section id="section_name ... and when loaded in the backend url:

.../admin/system_config/edit/section/section_name/...

Observer class:

namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer as EventObserver;
use Psr\Log\LoggerInterface as Logger;

class ConfigObserver implements ObserverInterface
{
    /**
     * @var Logger
     */
    protected $logger;

    /**
     * @param Logger $logger
     */
    public function __construct(
        Logger $logger
    ) {
        $this->logger = $logger;
    }

    public function execute(EventObserver $observer)
    {

        //$this->logger->info($observer->getWebsite());
        //$this->logger->info($observer->getStore());
    }
}

When go load the backend url I get error:

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

Element 'event', attribute 'name': 'admin_system_config_changed_section_section_name' 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

What seems to be the problem here? as far as I can see it's within naming convention [a-zA-Z_]+

0

It's a Bug.

https://github.com/magento/magento2/pull/12758.

It can't accept numbers.

Thanks

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