You are here

function entity_translation_settings_init in Entity Translation 7

Applies the given settings to every defined bundle.

Parameters

$entity_type: The entity type the settings refer to.

$settings: (optional) The settings to be applied. Defaults to the entity default settings.

1 call to entity_translation_settings_init()
entity_translation_update_7003 in ./entity_translation.install
Configure node and comment language settings to the prior default behavior.

File

./entity_translation.admin.inc, line 241
The entity translation user interface.

Code

function entity_translation_settings_init($entity_type, $settings = array()) {
  if (entity_translation_enabled($entity_type)) {
    $info = entity_get_info($entity_type);
    $bundles = !empty($info['bundles']) ? array_keys($info['bundles']) : array(
      $entity_type,
    );
    foreach ($bundles as $bundle) {
      if (entity_translation_enabled_bundle($entity_type, $bundle)) {
        $settings += entity_translation_settings($entity_type, $bundle);
      }
    }
    variable_set('entity_translation_settings_' . $entity_type . '__' . $bundle, $settings);
  }
}