Ok now I got no error but it doesn't work I'm surely making some mistakes :
use Flarum\Extend;
use s9e\TextFormatter\Configurator;
return [
// Register extenders here to customize your forum!
(new Extend\Formatter)
->configure(function (Configurator $config) {
$configurator = new s9e\TextFormatter\Configurator;
$configurator->MediaEmbed->add(
'ggmaps',
[
'host' => ['google.com'],
'extract' => [
"!google\\.com/maps/d/embed\\?mid=([-.&=0-9A-Z_a-z]+)!",
//"!youtube\\.com/watch\\?v=(?'id'[-0-9A-Z_a-z]+)!"
],
'iframe' => [
'width' => 560,
'height' => 315,
'src' => 'https://www.google.com/maps/d/embed?mid={@id}'
]
]
);
// Get an instance of the parser and the renderer
extract($configurator->finalize());
$text = '[media]https://www.google.com/maps/d/embed?mid=-cEzsCAzTak[/media]';
$xml = $parser->parse($text);
$html = $renderer->render($xml);
echo $html;
}),
];
I try to paste this https://www.google.com/maps/d/embed?mid=17Tr1RXRo-GFJ-lY4AaiQUOF22KkLV9ak&hl=fr
And it could work, there is no google's restrictions, here is the result by editing html in dev console :
I think it's a problem of regex that does not match... but the regex are really weird in the examples in documentation they failed in a regex online tester there is anything customized behind the scene, it's not a simple preg_match ?