![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-customer/Block/Widget/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Block\Widget; use Magento\Customer\Api\CustomerMetadataInterface; class AbstractWidget extends \Magento\Framework\View\Element\Template { /** * @var CustomerMetadataInterface */ protected $customerMetadata; /** * @var \Magento\Customer\Helper\Address */ protected $_addressHelper; /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Helper\Address $addressHelper * @param CustomerMetadataInterface $customerMetadata * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Helper\Address $addressHelper, CustomerMetadataInterface $customerMetadata, array $data = [] ) { $this->_addressHelper = $addressHelper; $this->customerMetadata = $customerMetadata; parent::__construct($context, $data); $this->_isScopePrivate = true; } /** * @param string $key * @return null|string */ public function getConfig($key) { return $this->_addressHelper->getConfig($key); } /** * @return string */ public function getFieldIdFormat() { if (!$this->hasData('field_id_format')) { $this->setData('field_id_format', '%s'); } return $this->getData('field_id_format'); } /** * @return string */ public function getFieldNameFormat() { if (!$this->hasData('field_name_format')) { $this->setData('field_name_format', '%s'); } return $this->getData('field_name_format'); } /** * @param string $field * @return string */ public function getFieldId($field) { return sprintf($this->getFieldIdFormat(), $field); } /** * @param string $field * @return string */ public function getFieldName($field) { return sprintf($this->getFieldNameFormat(), $field); } /** * Retrieve customer attribute instance * * @param string $attributeCode * @return \Magento\Customer\Api\Data\AttributeMetadataInterface|null */ protected function _getAttribute($attributeCode) { try { return $this->customerMetadata->getAttributeMetadata($attributeCode); } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { return null; } } }