In attempting to integrate Entity Translation into the Elections module I discovered an issue that took me many hours to determine exactly what was the issue. I had thought it was my declaration but in fact it was located in the entity_translation_edit_form_info function.
Essentially, you are attempting the following:
$entity_keys = explode('][', $entity_info['translation']['entity_translation']['edit form']);
$key_exists = FALSE;
$entity = drupal_array_get_nested_value($form_state, $entity_keys, $key_exists);
if ($key_exists) {
$info = array(
'entity type' => $form['#entity_type'],
'entity' => (object) $entity,
);
}
The problem being that the original developers were throwing the bundle up as post rather than election_post, which is the actual entity type name. Therefore, this always failed and the language switcher and translations never worked. So perhaps we could throw a message to the user OR to watchdog just to indicate that no object is found, because if they have turned on translation it should technically be there.
Comments