rendering a custom entity I have a custom entity 'sponsor'.

I want to create a custom template for that entity. But I still want to use the formatter settings that have been defined in the UI.

So 


I set the viewbuilder to the default EntityViewBuilder in my annotation
I defined the theme hook 'sponsor' in my .module file

function sponsors_theme(){
$theme_hook= array(
    'sponsor'=&gt;array(
        'variables'=&gt;array(
            'sponsor'=&gt;null,


        ),

        'template'=&gt;'sponsor',
    )
);

return $theme_hook;


}
Then I created my sponsor.html.twig file


Now I can access the raw values through {{sponsor.field.value}}

But I don't want to access all fields through their raw values. I still want to use the formatters. 

Is there anyone who can tell me how to do that or point me to the right docs? 

Matt.
You could craft a variable that holds all entity fields with respect to their order and formatter settings.

/**
 * Implements hook_theme().
 */
function sponsor_theme() {
  return [
    'sponsor' =&gt; [
      'render element' =&gt; 'elements',
    ],
  ];
}

/**
 * Prepares variables for sponsor templates.
 */
function template_preprocess_sponsor(&amp;$variables) {
  // Helpful $content variable for templates.
  $variables['content'] = [];
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}


This approach is used by core entities (node, user, comment etc).