I've followed this tutorial: https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html
This is my di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="PortailAxiane" xsi:type="array">
<item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Portail_Axiane::custommessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
This is my custommessage.phtml
<?php echo $block->escapeUrl($block->getData('url'))?>
And my message in my observer :
$this->_messageManager->addComplexErrorMessage(
'PortailAxiane',
array(
"url" => $produtToAddUrl
), null
);
But as the result, I only have the red rectangle. What did I missed ?