Download & Extend

Need a reliable way to determine if a specific bundle for an entity type is translatable

Project:Drupal core
Version:8.x-dev
Component:entity system
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:D8MI, needs backport to D7, pathauto

Issue Summary

For example, if I enable content translation (either via translation.module or a contrib module) for article node types but not page nodes, those modules should be altering hook_entity_info() for $info['node']['bundles']['article'] to indicate that translating is enabled.

Something like:

<?php
/**
* Implements hook_entity_info_alter().
*/
function translation_entity_info_alter(&$info) {
  foreach (
$info['node']['bundles'] as $type => &$bundle) {
    if (
translation_supported_type($type)) {
     
// Mark that translation.module is providing localization for this content type.
     
$bundle['translation']['translation'] = TRUE;
    }
  }
}
?>

Would also be nice to have a isTranslatable() method in the default Entity class that we can call as well (and an entity_is_translatable($entity_type, $entity) API addition for D7).

Comments

#1

Issue tags:+pathauto

This would assist the Pathauto contrib project help provide URL aliasing in an entity-generic fashion.