In the Entity Translation settings (admin/config/regional/entity_translation), if you check "Hide shared elements on translation forms" for Commerce Product, the "Save product" button and Cancel link disappear from the form when adding or editing a product translation.
Steps to reproduce
- Fresh install of Drupal 7.17.
- Enable Entity Translation 7.x-1.0-beta2+4-dev, Commerce 7.x-1.4+22-dev (enabling Product and Product UI).
- Add a language at admin/config/regional/language.
- Enable Entity Translation for Commerce Product entities at admin/config/regional/entity_translation, checking the "Hide shared elements on translation forms" option.
- Enable Entity translation for the default product type at admin/commerce/products/types/product/edit.
- Add a text field to the default product type at admin/commerce/products/types/product/fields.
- Add a product.
- Add a translation for this product. No button is shown to save the translation.

Relevant code from entity_translation
public function entityFormSharedElements(&$element) {
static $ignored_types, $shared_labels, $access;
if (!isset($ignored_types)) {
$ignored_types = array_flip(array('actions', 'value', 'hidden', 'vertical_tabs', 'token'));
}
…
Patch against 7.x-1.x-dev which changes the 'actions' element type from container to actions and resolves the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | commerce-1862942-10.patch | 5.24 KB | star-szr |
| #10 | interdiff.txt | 587 bytes | star-szr |
| #8 | commerce-1862942-8.patch | 4.67 KB | star-szr |
| #8 | interdiff.txt | 2.09 KB | star-szr |
| #6 | commerce-1862942-6.patch | 3.54 KB | star-szr |
Comments
Comment #1
rszrama commentedHmm, if I'm not mistaken, there is no form element type #actions. How do other modules supporting this feature of Entity Translation work?
Comment #2
bojanz commentedSure there is, from system_element_info():
Comment #3
star-szrYeah, it's legitimate:
http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...
Comment #4
rszrama commentedWow. Totally undocumented on api.d.o. :-/
We may as well make this a patch to use #actions anywhere we're just using a #container called actions.
Comment #5
star-szrThe actions element is documented under "Special Elements" in the Form API reference. I just learned about it today though :)
I like that idea. Updated patch to set all $form['actions'] to #type = actions.
Remaining '#type' => 'container' lines:
Comment #6
star-szrActually we can get rid of the attributes lines as well, that's covered by form_process_actions().
Comment #7
star-szrHate to say it but I think we can probably get rid of some of the #weight lines as well. system_element_info() (in @bojanz's comment) sets a default weight of 100, only commerce_product_product_form() sets a weight higher than 100.
Comment #8
star-szrI left the #weight = 40 ones alone, this patch flattens the arrays of the two $form actions that had a weight of 100 and moves them before the $form['actions']['submit'] lines. Sorry about all the patches :)
Comment #9
star-szrAnd this should probably get re-titled and re-filed, not sure about DX but i18n doesn't seem right anymore.
Comment #10
star-szrFound one form that has a $form['actions']['submit'] but doesn't declare $form['actions']. commerce_payment_order_transaction_add_form() should probably declare the actions element as well. One more patch for the road.
Comment #11
rszrama commentedRockin' my world! Thanks for all the updates. Haven't had a chance to review yet, but I'm lookin' forward to it. : )
Comment #12
star-szr#10: commerce-1862942-10.patch queued for re-testing.
Comment #13
star-szrAssigning so I can keep this on my radar. Patch still applies with an offset.
Comment #14
rszrama commentedLooks great - thanks for sticking with this, and welcome to the committers log. : )
Comment #15
star-szrGood news, thank you!