function quickedit_test_quickedit_render_field

Same name in other branches
  1. 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

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

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