We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If you want to open a new window when you click on the button & use the empty layout in it then you have to follow the below steps.

    Step 1: Place a new button in the admin and you have to make the on-click as per the below code.

    $this->setChild(
        'add_print_button',
        $this->getLayout()->createBlock('MagentoBackendBlockWidgetButton')->setData(
            [
                'label'     => __('Print Registry'),
                'onclick'   => "window.open('".$printUrl."','_blank', 'toolbar=yes,scrollbars=yes,resizable=yes')",
                'class'     => 'task action-primary registry-print',
            ]
        )
    );

    Step 2: Now in your controller you have to copy-paste the below code in the execute method to display your content in the empty layout.

    /** @var MagentoBackendModelViewResultPage $resultPage */
    $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
    
    $registryId = $this->getRequest()->getParam('registry_id');
    $registry = $this->registryFactory->create()->load($registryId);
    $items = $this->getPrintItems($registryId);
    
    $resultPage->addHandle('admin-empty');
    $this->_addContent($resultPage->getLayout()->createBlock('MirasvitGiftrBlockMailPrintitems')->setRegistry($registry)->setPrintItems($items));
    
    return $resultPage;

    That’s it. Now I can see content in the empty layout page in the Magento admin side by clicking the button.

    Note: This code is designed as per our requirement. You can modify it as per your requirements.

     

    field_5bfb909c5ccae

      Get a Free Quote