function EntityTestHooks::entityBundleInfoAlter
Implements hook_entity_bundle_info_alter().
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Hook/ EntityTestHooks.php, line 138
Class
- EntityTestHooks
- Hook implementations for entity_test.
Namespace
Drupal\entity_test\HookCode
public function entityBundleInfoAlter(&$bundles) {
$entity_info = \Drupal::entityTypeManager()->getDefinitions();
$state = \Drupal::state();
foreach ($bundles as $entity_type_id => &$all_bundle_info) {
if ($entity_info[$entity_type_id]->getProvider() == 'entity_test') {
if ($state->get('entity_test.translation') && $entity_info[$entity_type_id]->isTranslatable()) {
foreach ($all_bundle_info as &$bundle_info) {
$bundle_info['translatable'] = TRUE;
if ($state->get('entity_test.untranslatable_fields.default_translation_affected')) {
$bundle_info['untranslatable_fields.default_translation_affected'] = TRUE;
}
}
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.