I've created a controller with the route "/get-info", the controller return a template custom-info.html.twig
my_module/src/Controller/MyController.php
file:
<?php
namespace Drupal\my_module\Controller;
use Drupal\Core\Controller\ControllerBase;
class MyController extends ControllerBase {
public function content() {
return [
'#theme' => "custom_info",
];
}
}
my_module/templates/custom-info.html.twig
file:
<h1> Hello World </h1>
When visiting the path: www.mySite.com/get-info I get response with the header an footer of my site and "Hello World" as content. but when using <iframe src="www.mySite.com/get-info"></iframe>
in an other Drupal project I get an empty iframe.
Is this the right way to create iFrame-ready Widgets in Drupal 8? if so what should I add/remove to make it work?