One field (entity reference - paragraph) with two display modes
An array with 'type' =&gt; 'teaser' is specifying a field formatter, but you probably don't have a field formatter with this name.

You need to add the view mode (display mode) as string argument to view():. 

$variables['custom_display_mode'] = $variables['node']-&gt;get('field_gallery')
  -&gt;view('teaser');


For more info see How to apply a Field Formatter to a node field programmatically?