render call in hook_node_presave uses admin theme I am using hook_node_presave() to render my node and then save the output to a field field_node_cache.  However, when I do this, the renderer uses the admin theme, whereas I would like to use the site's main theme.

Is there a way to force it to use the site's main theme without disabling the admin theme?

function MYMODULE_node_presave(NodeInterface $entity) {
  switch ($entity-&gt;getType()) {
    case 'MY_CONTENT_TYPE':
      $render_controller = \Drupal::entityTypeManager()-&gt;getViewBuilder($entity-&gt;getEntityTypeId());
      $render_output = $render_controller-&gt;view($entity, 'MY_VIEW_MODE', 'ja');
      $html = \Drupal::service('renderer')-&gt;renderPlain($render_output);

      $entity-&gt;set('field_text_main_display', $html);
      $entity-&gt;field_node_cache-&gt;format = 'MY_FORMAT';
    break;
  }
}
One way to work around this is to go to /admin/appearance and uncheck Use the administration theme when editing or creating content.

Alternately, you can create a separate user account that does not have permission View the administration theme and use that account to create content.