class ContentTranslationManager implements ContentTranslationManagerInterface, BundleTranslationSettingsInterface (View source)

Provides common functionality for content translation.

Traits

Provides a standard way to announce deprecated properties.

Properties

protected $deprecatedProperties {@inheritdoc}
protected EntityTypeBundleInfoInterface $entityTypeBundleInfo

The entity type bundle info provider.

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

Methods

__get($name)

Allows to access deprecated/removed properties.

__construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info)

Constructs a ContentTranslationManageAccessCheck object.

getTranslationHandler(string $entity_type_id)

Returns an instance of the Content translation handler.

getTranslationMetadata(EntityInterface $translation)

Returns an instance of the Content translation metadata.

bool
isSupported(string $entity_type_id)

Checks whether an entity type supports translation.

getSupportedEntityTypes()

Gets the entity types that support content translation.

setEnabled(string $entity_type_id, string $bundle, bool $value)

Sets the value for translatability of the given entity type bundle.

isEnabled(string $entity_type_id, string $bundle = NULL)

Determines whether the given entity type is translatable.

setBundleTranslationSettings(string $entity_type_id, string $bundle, array $settings)

Sets translation settings for the specified bundle.

array
getBundleTranslationSettings(string $entity_type_id, string $bundle)

Returns translation settings for the specified bundle.

loadContentLanguageSettings(string $entity_type_id, string $bundle)

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

static bool
isPendingRevisionSupportEnabled(string $entity_type_id, string $bundle_id = NULL)

Checks whether support for pending revisions should be enabled.

Details

__get($name)

Allows to access deprecated/removed properties.

This method must be public.

Parameters

$name

__construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info)

Constructs a ContentTranslationManageAccessCheck object.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

EntityTypeBundleInfoInterface $entity_type_bundle_info

The entity type bundle info provider.

ContentTranslationHandlerInterface getTranslationHandler(string $entity_type_id)

Returns an instance of the Content translation handler.

Parameters

string $entity_type_id

The type of the entity being translated.

Return Value

ContentTranslationHandlerInterface

An instance of the content translation handler.

ContentTranslationMetadataWrapperInterface getTranslationMetadata(EntityInterface $translation)

Returns an instance of the Content translation metadata.

Parameters

EntityInterface $translation

The entity translation whose metadata needs to be retrieved.

Return Value

ContentTranslationMetadataWrapperInterface

An instance of the content translation metadata.

bool isSupported(string $entity_type_id)

Checks whether an entity type supports translation.

Parameters

string $entity_type_id

The entity type.

Return Value

bool

TRUE if an entity type is supported, FALSE otherwise.

EntityTypeInterface[] getSupportedEntityTypes()

Gets the entity types that support content translation.

Return Value

EntityTypeInterface[]

An array of entity types that support content translation.

setEnabled(string $entity_type_id, string $bundle, bool $value)

Sets the value for translatability of the given entity type bundle.

Parameters

string $entity_type_id

The entity type.

string $bundle

The bundle of the entity.

bool $value

The boolean value we need to save.

isEnabled(string $entity_type_id, string $bundle = NULL)

Determines whether the given entity type is translatable.

Parameters

string $entity_type_id

The type of the entity.

string $bundle

(optional) The bundle of the entity. If no bundle is provided, all the available bundles are checked.

setBundleTranslationSettings(string $entity_type_id, string $bundle, array $settings)

Sets translation settings for the specified bundle.

Parameters

string $entity_type_id

The entity type identifier.

string $bundle

The bundle name.

array $settings

An associative array of values keyed by setting name.

array getBundleTranslationSettings(string $entity_type_id, string $bundle)

Returns translation settings for the specified bundle.

Parameters

string $entity_type_id

The entity type identifier.

string $bundle

The bundle name.

Return Value

array

An associative array of values keyed by setting name.

protected ContentLanguageSettings loadContentLanguageSettings(string $entity_type_id, string $bundle)

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

ContentLanguageSettings

The content language config entity if one exists. Otherwise, returns default values.

static bool isPendingRevisionSupportEnabled(string $entity_type_id, string $bundle_id = NULL)

internal  There is ongoing discussion about how pending revisions should behave. The logic enabling pending revision support is likely to change once a decision is made.
 

Checks whether support for pending revisions should be enabled.

Parameters

string $entity_type_id

The ID of the entity type to be checked.

string $bundle_id

(optional) The ID of the bundle to be checked. Defaults to none.

Return Value

bool

TRUE if pending revisions should be enabled, FALSE otherwise.

See also

https://www.drupal.org/node/2940575