function entity_test_entity_form_mode_alter in Drupal 10
Same name and namespace in other branches
- 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_mode_alter()
Implements hook_entity_form_mode_alter().
File
- core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 438 - Test module for the entity API providing several entity types for testing.
Code
function entity_test_entity_form_mode_alter(&$form_mode, EntityInterface $entity) {
if ($entity
->getEntityTypeId() === 'entity_test' && $entity
->get('name')->value === 'compact_form_mode') {
$form_mode = 'compact';
}
}