function quickedit_test_quickedit_render_field in Drupal 10
Same name and namespace in other branches
- 8 core/modules/quickedit/tests/modules/quickedit_test.module \quickedit_test_quickedit_render_field()
- 9 core/modules/quickedit/tests/modules/quickedit_test.module \quickedit_test_quickedit_render_field()
Implements hook_quickedit_render_field().
File
- core/
modules/ quickedit/ tests/ modules/ quickedit_test.module, line 13 - Helper module for the Quick Edit tests.
Code
function quickedit_test_quickedit_render_field(EntityInterface $entity, $field_name, $view_mode_id, $langcode) {
$entity = \Drupal::service('entity.repository')
->getTranslationFromContext($entity, $langcode);
return [
'#prefix' => '<div class="quickedit-test-wrapper">',
'field' => $entity
->get($field_name)
->view($view_mode_id),
'#suffix' => '</div>',
];
}