Zend certified PHP/Magento developer

Email load custom php with variable strict mode – Magento 2

Since Magento 2.3.4 email variable usage was deprecated. See: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email-migration.html

But we are using a email variable to load a custom php template, that loads specific values based on the payment method and customer group of the customer.

We load it at the moment like:

{{block class="MagentoFrameworkViewElementTemplate" order=$order name="order_payment" template="Magento_Sales::email/paymentmethod.phtml" area="frontend"}}

And inside the paymentmethod.phtml we load the following php values, but these will not work anymore. Because it is not pushing the order anymore to the paymentmethod.phtml.

$order = $this->getData('order');
$orderid = $order->getId();
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
$methodTitle = $method->getTitle();

But this will not work anymore in 2.4.4, so we need to modify this.

How can we still load this custom php, that checks the payment method and customer group of the customer and then load a specific text line?