Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
View.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
21 
28  public function __construct(
29  \Magento\Framework\App\Helper\Context $context,
30  CustomerMetadataInterface $customerMetadataService
31  ) {
32  $this->_customerMetadataService = $customerMetadataService;
33  parent::__construct($context);
34  }
35 
40  {
41  $name = '';
42  $prefixMetadata = $this->_customerMetadataService->getAttributeMetadata('prefix');
43  if ($prefixMetadata->isVisible() && $customerData->getPrefix()) {
44  $name .= $customerData->getPrefix() . ' ';
45  }
46 
47  $name .= $customerData->getFirstname();
48 
49  $middleNameMetadata = $this->_customerMetadataService->getAttributeMetadata('middlename');
50  if ($middleNameMetadata->isVisible() && $customerData->getMiddlename()) {
51  $name .= ' ' . $customerData->getMiddlename();
52  }
53 
54  $name .= ' ' . $customerData->getLastname();
55 
56  $suffixMetadata = $this->_customerMetadataService->getAttributeMetadata('suffix');
57  if ($suffixMetadata->isVisible() && $customerData->getSuffix()) {
58  $name .= ' ' . $customerData->getSuffix();
59  }
60  return $name;
61  }
62 }
$customerData
__construct(\Magento\Framework\App\Helper\Context $context, CustomerMetadataInterface $customerMetadataService)
Definition: View.php:28
getCustomerName(CustomerInterface $customerData)
Definition: View.php:39
if(!isset($_GET['name'])) $name
Definition: log.php:14