Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContentTranslationManager.php

function 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.

4 calls to ContentTranslationManager::loadContentLanguageSettings()
ContentTranslationManager::getBundleTranslationSettings in core/modules/content_translation/src/ContentTranslationManager.php
ContentTranslationManager::isEnabled in core/modules/content_translation/src/ContentTranslationManager.php
ContentTranslationManager::setBundleTranslationSettings in core/modules/content_translation/src/ContentTranslationManager.php
ContentTranslationManager::setEnabled in core/modules/content_translation/src/ContentTranslationManager.php

File

core/modules/content_translation/src/ContentTranslationManager.php, line 137

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->entityTypeManager
        ->getStorage('language_content_settings')
        ->load($entity_type_id . '.' . $bundle);
    if ($config == NULL) {
        $config = $this->entityTypeManager
            ->getStorage('language_content_settings')
            ->create([
            'target_entity_type_id' => $entity_type_id,
            'target_bundle' => $bundle,
        ]);
    }
    return $config;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal