Same name and namespace in other branches
- 8.9.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_mode_info_alter()
- 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_mode_info_alter()
Implements hook_entity_form_mode_info_alter().
File
- core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 285 - Test module for the entity API providing several entity types for testing.
Code
function entity_test_entity_form_mode_info_alter(&$form_modes) {
$entity_info = \Drupal::entityTypeManager()
->getDefinitions();
foreach ($entity_info as $entity_type => $info) {
if ($entity_info[$entity_type]
->getProvider() == 'entity_test') {
$form_modes[$entity_type]['compact'] = [
'label' => t('Compact version'),
'status' => TRUE,
];
}
}
}