123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Sales\Block\Adminhtml\Order;
- use Magento\Payment\Model\Info;
- /**
- * Adminhtml sales order payment information
- *
- * @api
- * @author Magento Core Team <core@magentocommerce.com>
- * @since 100.0.2
- */
- class Payment extends \Magento\Backend\Block\Template
- {
- /**
- * Payment data
- *
- * @var \Magento\Payment\Helper\Data
- */
- protected $_paymentData = null;
- /**
- * @param \Magento\Backend\Block\Template\Context $context
- * @param \Magento\Payment\Helper\Data $paymentData
- * @param array $data
- */
- public function __construct(
- \Magento\Backend\Block\Template\Context $context,
- \Magento\Payment\Helper\Data $paymentData,
- array $data = []
- ) {
- $this->_paymentData = $paymentData;
- parent::__construct($context, $data);
- }
- /**
- * Retrieve required options from parent
- *
- * @return void
- * @throws \Magento\Framework\Exception\LocalizedException
- */
- protected function _beforeToHtml()
- {
- if (!$this->getParentBlock()) {
- throw new \Magento\Framework\Exception\LocalizedException(__('Invalid parent block for this block'));
- }
- $this->setPayment($this->getParentBlock()->getOrder()->getPayment());
- parent::_beforeToHtml();
- }
- /**
- * Set payment
- *
- * @param Info $payment
- * @return $this
- */
- public function setPayment($payment)
- {
- $paymentInfoBlock = $this->_paymentData->getInfoBlock($payment, $this->getLayout());
- $this->setChild('info', $paymentInfoBlock);
- $this->setData('payment', $payment);
- return $this;
- }
- /**
- * Prepare html output
- *
- * @return string
- */
- protected function _toHtml()
- {
- return $this->getChildHtml('info');
- }
- }
|