function entity_translation_field_extra_fields in Entity Translation 7
Implements hook_field_extra_fields().
File
- ./
entity_translation.module, line 886
Code
function entity_translation_field_extra_fields() {
$extra = array();
$enabled = variable_get('entity_translation_entity_types', array());
$info = entity_get_info();
foreach ($enabled as $entity_type) {
if (entity_translation_enabled($entity_type)) {
$bundles = !empty($info[$entity_type]['bundles']) ? array_keys($info[$entity_type]['bundles']) : array(
$entity_type,
);
foreach ($bundles as $bundle) {
$settings = entity_translation_settings($entity_type, $bundle);
if (empty($settings['hide_language_selector']) && entity_translation_enabled_bundle($entity_type, $bundle) && ($handler = entity_translation_get_handler($entity_type, $bundle))) {
$language_key = $handler
->getLanguageKey();
$extra[$entity_type][$bundle] = array(
'form' => array(
$language_key => array(
'label' => t('Language'),
'description' => t('Language selection'),
'weight' => 5,
),
),
);
}
}
}
}
return $extra;
}