Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Form.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Payment\Block;
7 
9 
17 {
24  public function getMethod()
25  {
26  $method = $this->getData('method');
27 
28  if (!$method instanceof MethodInterface) {
29  throw new \Magento\Framework\Exception\LocalizedException(
30  __('We cannot retrieve the payment method model object.')
31  );
32  }
33  return $method;
34  }
35 
43  {
44  $this->setData('method', $method);
45  return $this;
46  }
47 
53  public function getMethodCode()
54  {
55  return $this->getMethod()->getCode();
56  }
57 
64  public function getInfoData($field)
65  {
66  return $this->escapeHtml($this->getMethod()->getInfoInstance()->getData($field));
67  }
68 }
getData($key='', $index=null)
Definition: DataObject.php:119
__()
Definition: __.php:13
$method
Definition: info.phtml:13
setData($key, $value=null)
Definition: DataObject.php:72
setMethod(MethodInterface $method)
Definition: Form.php:42