You are here

function entity_translation_enable in Entity Translation 7

Implements hook_enable().

File

./entity_translation.install, line 253
Installation functions for Entity Translation module.

Code

function entity_translation_enable() {

  // Re-activate entity translation for content types which had used it when
  // the module was last disabled (if any), unless these have since been altered
  // by the user to use a different translation option.
  $entity_translation_types = variable_get('entity_translation_disabled_content_types', array());
  foreach ($entity_translation_types as $index => $type) {
    if (variable_get("language_content_type_{$type}", 0) == 0) {
      variable_set("language_content_type_{$type}", ENTITY_TRANSLATION_ENABLED);
    }
    else {
      unset($entity_translation_types[$index]);
    }
  }
  if ($entity_translation_types) {
    drupal_set_message(t('All content types previously configured to use field translation are now using it again.'), 'warning');
  }
  variable_del('entity_translation_disabled_content_types');
}