You are here

protected function ContentTranslationManager::loadContentLanguageSettings in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::loadContentLanguageSettings()

Loads a content language config entity based on the entity type and bundle.

Parameters

string $entity_type_id: ID of the entity type.

string $bundle: Bundle name.

Return value

\Drupal\language\Entity\ContentLanguageSettings The content language config entity if one exists. Otherwise, returns default values.

2 calls to ContentTranslationManager::loadContentLanguageSettings()
ContentTranslationManager::isEnabled in core/modules/content_translation/src/ContentTranslationManager.php
Determines whether the given entity type is translatable.
ContentTranslationManager::setEnabled in core/modules/content_translation/src/ContentTranslationManager.php
Sets the value for translatability of the given entity type bundle.

File

core/modules/content_translation/src/ContentTranslationManager.php, line 125
Contains \Drupal\content_translation\ContentTranslationManager.

Class

ContentTranslationManager
Provides common functionality for content translation.

Namespace

Drupal\content_translation

Code

protected function loadContentLanguageSettings($entity_type_id, $bundle) {
  if ($entity_type_id == NULL || $bundle == NULL) {
    return NULL;
  }
  $config = $this->entityManager
    ->getStorage('language_content_settings')
    ->load($entity_type_id . '.' . $bundle);
  if ($config == NULL) {
    $config = $this->entityManager
      ->getStorage('language_content_settings')
      ->create([
      'target_entity_type_id' => $entity_type_id,
      'target_bundle' => $bundle,
    ]);
  }
  return $config;
}