function ContentTranslationManager::isEnabled

Same name in other branches
  1. 9 core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::isEnabled()
  2. 8.9.x core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::isEnabled()
  3. 11.x core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::isEnabled()

File

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

Class

ContentTranslationManager
Provides common functionality for content translation.

Namespace

Drupal\content_translation

Code

public function isEnabled($entity_type_id, $bundle = NULL) {
    $enabled = FALSE;
    if ($this->isSupported($entity_type_id)) {
        $bundles = !empty($bundle) ? [
            $bundle,
        ] : array_keys($this->entityTypeBundleInfo
            ->getBundleInfo($entity_type_id));
        foreach ($bundles as $bundle) {
            $config = $this->loadContentLanguageSettings($entity_type_id, $bundle);
            if ($config->getThirdPartySetting('content_translation', 'enabled', FALSE)) {
                $enabled = TRUE;
                break;
            }
        }
    }
    return $enabled;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.