function entity_test_entity_form_mode_alter

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_mode_alter()
  2. 10 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 447

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';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.