function UserNameFormatterTest::renderEntityFields

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/Field/UserNameFormatterTest.php \Drupal\Tests\user\Kernel\Field\UserNameFormatterTest::renderEntityFields()
  2. 8.9.x core/modules/user/tests/src/Kernel/Field/UserNameFormatterTest.php \Drupal\Tests\user\Kernel\Field\UserNameFormatterTest::renderEntityFields()
  3. 11.x core/modules/user/tests/src/Kernel/Field/UserNameFormatterTest.php \Drupal\Tests\user\Kernel\Field\UserNameFormatterTest::renderEntityFields()

Renders fields of a given entity with a given display.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity object with attached fields to render.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The display to render the fields in.

Return value

string The rendered entity fields.

File

core/modules/user/tests/src/Kernel/Field/UserNameFormatterTest.php, line 64

Class

UserNameFormatterTest
Tests the user_name formatter.

Namespace

Drupal\Tests\user\Kernel\Field

Code

protected function renderEntityFields(FieldableEntityInterface $entity, EntityViewDisplayInterface $display) {
    $content = $display->build($entity);
    $content = $this->render($content);
    return $content;
}

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