function ContentTranslationManager::isPendingRevisionSupportEnabled

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

Checks whether support for pending revisions should be enabled.

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

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

6 calls to ContentTranslationManager::isPendingRevisionSupportEnabled()
ContentTranslationController::add in core/modules/content_translation/src/Controller/ContentTranslationController.php
Builds an add translation page.
ContentTranslationController::overview in core/modules/content_translation/src/Controller/ContentTranslationController.php
Builds the translations overview page.
ContentTranslationDeleteAccess::checkAccess in core/modules/content_translation/src/Access/ContentTranslationDeleteAccess.php
Checks access to translation deletion for the specified entity.
ContentTranslationHandler::entityFormAlter in core/modules/content_translation/src/ContentTranslationHandler.php
Performs the needed alterations to the entity form.
ContentTranslationRouteSubscriber::alterRoutes in core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php
Alters existing routes for a specific collection.

... See full list

File

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

Class

ContentTranslationManager
Provides common functionality for content translation.

Namespace

Drupal\content_translation

Code

public static function isPendingRevisionSupportEnabled($entity_type_id, $bundle_id = NULL) {
  if (!\Drupal::moduleHandler()->moduleExists('content_moderation')) {
    return FALSE;
  }
  $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
  if ($bundle_id) {
    return \Drupal::service('content_moderation.moderation_information')->shouldModerateEntitiesOfBundle($entity_type, $bundle_id);
  }
  else {
    return \Drupal::service('content_moderation.moderation_information')->canModerateEntitiesOfEntityType($entity_type);
  }
}

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