<?php
/** @var \Magetop\Advancepreview\Block\Order\CustomInvoiceEmail $block */
/** @var \Magento\Sales\Model\Order $_order*/
$_order = $block->getData('order');
/** @var \Magento\Sales\Model\Order\Invoice\Item $invoice*/
$invoice = $block->getData('invoice');
/*echo get_class($invoice);
echo get_class($_order);

echo $item != null && $item->getId() ? 'OK' : 'Xit me rui order id_' .$_order->getId() .'_ incvoixcwe' . $invoice->getId();*/
$item = $block->getItemByItemId($_order,$invoice->getId());
if($item && $item->getId()) {
    echo $block->getLayout()->createBlock('Magetop\Advancepreview\Block\Order\CustomOrderView')->setData(array('order'=>$_order,'item'=>$item))->setTemplate('Magetop_Advancepreview::order/email/items/custom_default_item.phtml')->toHtml();
}
?>
