(This only occurs with entity revision scheduler enabled.) ET's language fallback must be turned off as well.

To repro:

  1. enable ERS, configure site for translation
  2. disable language fallback at admin/config/regional/entity_translation
  3. create and "Save and Publish" a new piece of content that is translation enabled (node or field translation)
  4. view the content as an anonymous user (not logged in)
  5. observe a warning
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ethanethan’s picture

Status: Active » Needs review
FileSize
499 bytes

Looked like the status field in entity_translation is important for the visibility to anonymous users. This fix reads the published state off the entity in question and applies it to the entity as its stored in entity_translation.

Is this a good fix?

plach’s picture

Status: Needs review » Needs work
+++ b/includes/translation.handler.inc
@@ -343,6 +343,7 @@ class EntityTranslationDefaultHandler implements EntityTranslationHandlerInterfa
+	'status' => (int)$this->entity->status

Not every entity defines a status property: you may want to try $this->getStatus(). Also, indenting tabs should be replaced with spaces.

However I don't think this is the right fix since it's basically ignoring the status set in the translation record.

ethanethan’s picture

Hm, ok thanks for the quick reply. Any pointers on how to solve this? Or where to look? Where is the $entity->translations set and modified?

ethanethan’s picture

Did some more work on Friday-- here's the fix that has worked for us. Just adds a listener to the ERS form which publishes the content. Since only the source node in the translation set is invisible to anon users, only that one is updated:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function entity_translation_form_ers_entity_schedule_full_form_alter(&$form, &$form_state, $form_id){
  $form['#submit'][] = 'entity_translation_ers_entity_schedule_full_form_submit';
}

/**
 * Hook into ERS's Publish form, to set correct published state on the source
 * "translation" for entity_translation.
 */
function entity_translation_ers_entity_schedule_full_form_submit(&$form, &$form_state){
  $entity = $form_state['entity'];
  $entity_type = $form_state['entity_type'];
  $handler = entity_translation_get_handler($entity_type, $entity);
  $source = array(
    // use entity_language instead to get source?
    'language' => $entity->language,
    'status' => 1,
  );
  $handler->setTranslation($source);
  $handler->saveTranslations();
}