public static function ContentTranslationManager::isPendingRevisionSupportEnabled in Drupal 10
Same name and namespace in other branches
- 8 core/modules/content_translation/src/ContentTranslationManager.php \Drupal\content_translation\ContentTranslationManager::isPendingRevisionSupportEnabled()
- 9 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
7 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 - ContentTranslationRouteSubscriber::alterRoutes in core/
modules/ content_translation/ src/ Routing/ ContentTranslationRouteSubscriber.php - Alters existing routes for a specific collection.
File
- core/
modules/ content_translation/ src/ ContentTranslationManager.php, line 166
Class
- ContentTranslationManager
- Provides common functionality for content translation.
Namespace
Drupal\content_translationCode
public static function isPendingRevisionSupportEnabled($entity_type_id, $bundle_id = NULL) {
if (!\Drupal::moduleHandler()
->moduleExists('content_moderation')) {
return FALSE;
}
foreach (Workflow::loadMultipleByType('content_moderation') as $workflow) {
/** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration $plugin */
$plugin = $workflow
->getTypePlugin();
$entity_type_ids = array_flip($plugin
->getEntityTypes());
if (isset($entity_type_ids[$entity_type_id])) {
if (!isset($bundle_id)) {
return TRUE;
}
else {
$bundle_ids = array_flip($plugin
->getBundlesForEntityType($entity_type_id));
if (isset($bundle_ids[$bundle_id])) {
return TRUE;
}
}
}
}
return FALSE;
}