Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractContainer.php
Go to the documentation of this file.
1 <?php
7 
15 {
21  protected $_paymentData = null;
22 
28  public function __construct(
29  \Magento\Framework\View\Element\Template\Context $context,
30  \Magento\Payment\Helper\Data $paymentData,
31  array $data = []
32  ) {
33  $this->_paymentData = $paymentData;
34  parent::__construct($context, $data);
35  }
36 
42  protected function _prepareLayout()
43  {
44  if ($info = $this->getPaymentInfo()) {
45  $this->setChild($this->_getInfoBlockName(), $this->_paymentData->getInfoBlock($info, $this->getLayout()));
46  }
47  return parent::_prepareLayout();
48  }
49 
55  protected function _getInfoBlockName()
56  {
57  if ($info = $this->getPaymentInfo()) {
58  return 'payment.info.' . $info->getMethodInstance()->getCode();
59  }
60  return false;
61  }
62 
68  abstract public function getPaymentInfo();
69 
77  public function setInfoTemplate($method = '', $template = '')
78  {
79  if ($info = $this->getPaymentInfo()) {
80  if ($info->getMethodInstance()->getCode() == $method) {
81  $this->getChildBlock($this->_getInfoBlockName())->setTemplate($template);
82  }
83  }
84  return $this;
85  }
86 }
$method
Definition: info.phtml:13
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Payment\Helper\Data $paymentData, array $data=[])
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52
$template
Definition: export.php:12