I want the site email address to be located at the same domain as the website. If an email address with different domain is provided such value should not be saved into config.

I have taken care of this in UI but what about if some module sets this value(via custom form or programmatically) that I have no control over? How can I prevent it from making the change?

I asked on irc but it turned out the config has no constraint or validation mechanism other than the data type/format.

Am I missing something or there is really no way of "protecting" the config?

In \Drupal\Core\Config\Config::save I see there is an event dispatched but it is only after the value has already been saved into storage.

  • 1
    In 7, there were none. And to think about it - why should there be? I mean, for forms OK, but for modules? If I install module, I want it to work. I would be pretty irritated if I found other modules are interfering. And of course if your module could establish guard, other could remove it, right? – Mołot Aug 29 '15 at 11:01
  • Here is how you do it in Drupal 7 - just if anybody wonders. maybe some of this approach would be salvageable? – Mołot Aug 29 '15 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy