Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Info Class Reference
Inheritance diagram for Info:
Template AbstractBlock DataObject BlockInterface Checkmo Purchaseorder ConfigurableInfo Cc Instructions Substitution Agreement Info Info Info Info Info Info

Public Member Functions

 getInfo ()
 
 getMethod ()
 
 toPdf ()
 
 getChildPdfAsArray ()
 
 getSpecificInformation ()
 
 getValueAsArray ($value, $escapeHtml=false)
 
 getIsSecureMode ()
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from BlockInterface
 toHtml ()
 

Protected Member Functions

 _prepareSpecificInformation ($transport=null)
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_paymentSpecificInformation
 
 $_template = 'Magento_Payment::info/default.phtml'
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Base payment information block

@api

Since
100.0.2

Definition at line 14 of file Info.php.

Member Function Documentation

◆ _prepareSpecificInformation()

_prepareSpecificInformation (   $transport = null)
protected

Prepare information specific to current payment method

Parameters
null | \Magento\Framework\DataObject | array$transport
Returns
\Magento\Framework\DataObject

Definition at line 150 of file Info.php.

151  {
152  if (null === $this->_paymentSpecificInformation) {
153  if (null === $transport) {
154  $transport = new \Magento\Framework\DataObject();
155  } elseif (is_array($transport)) {
156  $transport = new \Magento\Framework\DataObject($transport);
157  }
158  $this->_paymentSpecificInformation = $transport;
159  }
161  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ getChildPdfAsArray()

getChildPdfAsArray ( )

Getter for children PDF, as array. Analogue of $this->getChildHtml()

Children must have toPdf() callable Known issue: not sorted

Returns
array

Definition at line 72 of file Info.php.

73  {
74  $result = [];
75  foreach ($this->getLayout()->getChildBlocks($this->getNameInLayout()) as $child) {
76  if (method_exists($child, 'toPdf') && is_callable([$child, 'toPdf'])) {
77  $result[] = $child->toPdf();
78  }
79  }
80  return $result;
81  }

◆ getInfo()

getInfo ( )

Retrieve info model

Returns
\Magento\Payment\Model\InfoInterface
Exceptions

Definition at line 34 of file Info.php.

35  {
36  $info = $this->getData('info');
37  if (!$info instanceof \Magento\Payment\Model\InfoInterface) {
38  throw new \Magento\Framework\Exception\LocalizedException(
39  __('We cannot retrieve the payment info model object.')
40  );
41  }
42  return $info;
43  }
getData($key='', $index=null)
Definition: DataObject.php:119
__()
Definition: __.php:13
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52

◆ getIsSecureMode()

getIsSecureMode ( )

Check whether payment information should show up in secure mode true => only "public" payment information may be shown false => full information may be shown

Returns
bool @SuppressWarnings(PHPMD.BooleanGetMethodName)

Definition at line 124 of file Info.php.

125  {
126  if ($this->hasIsSecureMode()) {
127  return (bool)(int)$this->_getData('is_secure_mode');
128  }
129 
130  $method = $this->getMethod();
131  if (!$method) {
132  return true;
133  }
134 
135  $store = $method->getStore();
136  if (!$store) {
137  return false;
138  }
139 
140  $methodStore = $this->_storeManager->getStore($store);
141  return $methodStore->getCode() != \Magento\Store\Model\Store::ADMIN_CODE;
142  }
$method
Definition: info.phtml:13

◆ getMethod()

getMethod ( )

Retrieve payment method model

Returns
\Magento\Payment\Model\MethodInterface

Definition at line 50 of file Info.php.

51  {
52  return $this->getInfo()->getMethodInstance();
53  }

◆ getSpecificInformation()

getSpecificInformation ( )

Get some specific information in format of array($label => $value)

Returns
array

Definition at line 88 of file Info.php.

89  {
90  return $this->_prepareSpecificInformation()->getData();
91  }
_prepareSpecificInformation($transport=null)
Definition: Info.php:150

◆ getValueAsArray()

getValueAsArray (   $value,
  $escapeHtml = false 
)

Render the value as an array

Parameters
mixed$value
bool$escapeHtml
Returns
array

Definition at line 100 of file Info.php.

101  {
102  if (empty($value)) {
103  return [];
104  }
105  if (!is_array($value)) {
106  $value = [$value];
107  }
108  if ($escapeHtml) {
109  foreach ($value as $_key => $_val) {
110  $value[$_key] = $this->escapeHtml($_val);
111  }
112  }
113  return $value;
114  }
$value
Definition: gender.phtml:16

◆ toPdf()

toPdf ( )

Render as PDF

Returns
string

Definition at line 59 of file Info.php.

60  {
61  $this->setTemplate('Magento_Payment::info/pdf/default.phtml');
62  return $this->toHtml();
63  }

Field Documentation

◆ $_paymentSpecificInformation

$_paymentSpecificInformation
protected

Definition at line 21 of file Info.php.

◆ $_template

$_template = 'Magento_Payment::info/default.phtml'
protected

Definition at line 26 of file Info.php.


The documentation for this class was generated from the following file: