Entity translation module is deprecating getFormLanguage() and introducing getActiveLanguage() instead. Let's update Field collection accordingly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

czigor created an issue. See original summary.

czigor’s picture

Status: Needs review » Needs work

The last submitted patch, 2: field_collection-2855148-2-entity_translation.patch, failed testing.

czigor’s picture

Title: Update Entity translation API usage » Update Entity translation API usage in Field collection
plach’s picture

In my local environment the test is green, maybe the bot is not picking up the updated ET code yet.

plach’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

*** EDIT ***
brain fart.
*** EDIT ***

joseph.olstad’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Needs review

Actually, the fallback mode the legacy api is still supported by beta6, but the new API function makes more sense. Suggest adding hook_requirements with patch. See forthcomming patch 9

/**
 * Implements hook_requirements().
 */
function field_collection_requirements($phase) {
  $t = get_t();
  // Make to notify people to upgrade to entity_translation beta6
  $requirements = array();

  if (module_exists('entity_translation')) {
    if ($phase == 'update' || $phase == 'install' || $phase == 'runtime' ) {
      $entity_translation_info = system_get_info('module', 'entity_translation');
      $et_installed_version = $entity_translation_info['version'];
      $et_installed_datestamp = $entity_translation_info['datestamp'];
      $march3rd_entity_translation_timestamp = 1488530885;
      if (!isset($entity_translation_info['version']) || !isset($entity_translation_info['datestamp'])) {
        $et_installed_datestamp = 1488530884;
      }

      if ($et_installed_datestamp < $march3rd_entity_translation_timestamp) {
        $description = $t('Your entity_translation installation version: %version is too old. field_collection requires entity_translation at least beta6 from march 3 2017 or newer.  Your choice is to either upgrade entity_translation or to disable it.', array('%version' => $et_installed_version));
        $requirements['entity_translation']['description'] = $description;
        $requirements['entity_translation']['severity'] = REQUIREMENT_ERROR;
        $requirements['entity_translation']['value'] = $et_installed_version;
        $requirements['entity_translation']['title'] = $t('Entity translation (when installed) with Field Collection');
	drupal_set_message($description, 'error', TRUE);
      }
    }
  }
  return $requirements;
}
joseph.olstad’s picture

joseph.olstad’s picture

Chris Matthews’s picture

Status: Needs review » Reviewed & tested by the community
Checking patch field_collection.install...
Hunk #1 succeeded at 98 (offset 6 lines).

Checking patch includes/translation.handler.field_collection_item.inc...
error: while searching for:
    // language.
    if (($host_entity_type = $this->entity->hostEntityType()) && entity_translation_enabled($host_entity_type) && ($host_entity = $this->entity->hostEntity())) {
      $handler = $this->factory->getHandler($host_entity_type, $host_entity);
      $langcode = $handler->getFormLanguage();
    }
    // If the host entity is not translatable, use the default language
    // fallback.

error: patch failed: includes/translation.handler.field_collection_item.inc:42
error: includes/translation.handler.field_collection_item.inc: patch does not apply

Status: Reviewed & tested by the community » Needs work
joseph.olstad’s picture

appears the patch needs a reroll.

Chris Matthews’s picture

Issue tags: +Needs reroll
joseph.olstad’s picture

Status: Needs work » Closed (outdated)

related code no longer found, appears that field collections changed completely it's approach to translation.