The draft submit button has no #name property and this means that the only way tho test if is has been triggered is to test #value. Unfortunately this is not a good choice to do that because other modules may change it or it can be changed by the localization.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | save_draft-add_the_#name_property_to_the_submit.patch | 496 bytes | JulienD |
Comments
Comment #1
JulienD commentedComment #2
JulienD commentedComment #3
rooby commentedThere is a bit of a tradeoff here.
It has (unfortunately) been a bit of a convention in Drupal to use
$form_state['values']['op']to detect button presses so changing this risks breaking other module code that relied on that.That said, I think the risk of that is fairly low in this case so it could be aded a a notice in the release notes of the next release.
This would also be an issue for you elsewhere in Drupal in terms of your tests since so many buttons don't specify a #name, so it seels like you would have to work around this in some way anyway.
Regardless of that though, this will break existing tests so your patch will need to update the tests.