You are here

function entity_translation_unified_form_language_display in Entity Translation Unified Form 8

Returns the language display mode for a given bundle

2 calls to entity_translation_unified_form_language_display()
EntityTranslationUnifiedFormInlineMode::alterTitle in src/Plugin/EntityTranslationUnifiedFormMode/EntityTranslationUnifiedFormInlineMode.php
Helper function to add the language label to a title.
entity_translation_unified_form_form_language_content_settings_form_alter in ./entity_translation_unified_form.module
Implements hook_form_form_language_content_settings_form_alter().

File

./entity_translation_unified_form.module, line 308

Code

function entity_translation_unified_form_language_display($entity_type_id, $bundle) {

  /** @var \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager */
  $content_translation_manager = \Drupal::service('content_translation.manager');
  if ($content_translation_manager instanceof BundleTranslationSettingsInterface) {
    $settings = $content_translation_manager
      ->getBundleTranslationSettings($entity_type_id, $bundle);
    if (!empty($settings['entity_translation_unified_form_language'])) {
      return $settings['entity_translation_unified_form_language'];
    }
  }
  return NULL;
}