I'm attempting to render a webform inside a block plugin. I'm able to successfully retrieve the webform using the following code
$webform = \Drupal::entityTypeManager()->getStorage('webform')->load('my_webform');
However I'd like to render this form. I've attempted using
return $webform;
But I receive the error
Recoverable fatal error: Argument 1 passed to Drupal\Core\Render\Element::isEmpty() must be of the type array, object given
I'm assuming this is because $webform isn't formatted as a proper render array, but I'm not sure how to do this. I've been searching for clues inside the code of the original webform module, but I haven't been able to find anything.
How would I programmatically render a webform? And/or is there a way to find in the code of a module or entity the way to render that entity?