Updated: Comment #0
(Almost?) All config entities have a machine name form field with an 'exists' callback that checks for an existing entity of that type with a given name. Each config entity has to implement such a callback even though it can easily be done in a generic fashion. What's worse: Even though the best practice is to perform these 'exists' check with an entity query many config entities simply defer this to the 'foo_load()' function which performs completely unnecessary loading. This already happens several times in core and will be even more widespread in contrib, I fear.
It seems this is a great use-case for a generic exists() method on the form controller. This only concerns config entities, though, so we need to create a new ConfigEntityForm.
- Agree that this makes sense
- Write patch
- Review patch
- Commit patch
No BC-breaks. There's a new ConfigEntityFormController that it's a best practice to extend.
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 75,674 pass(es), 108 fail(s), and 0 exception(s).|
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 75,242 pass(es), 131 fail(s), and 24 exception(s).|
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 75,416 pass(es), 108 fail(s), and 3 exception(s).|