26 private static $genderAttributeCode =
'gender';
31 private static $groupAttributeCode =
'group_id';
36 private static $websiteAttributeCode =
'website_id';
41 private static $websiteIdAttributeCode =
'original_website_id';
46 private static $confirmationAttributeCode =
'confirmation';
51 private static $accountLockAttributeCode =
'lock_expires';
56 private $customerMetadata;
61 private $groupRepository;
66 private $storeManager;
89 $this->customerMetadata = $customerMetadata;
92 $this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->create(ScopeConfigInterface::class);
101 case self::$genderAttributeCode:
102 $this->setGenderValue();
104 case self::$groupAttributeCode:
105 $this->setCustomerGroupValue();
107 case self::$websiteAttributeCode:
108 $this->setWebsiteValue();
110 case self::$confirmationAttributeCode:
111 $this->setConfirmationValue();
113 case self::$accountLockAttributeCode:
114 $this->setAccountLockValue();
125 private function setGenderValue()
135 $attributeMetadata = $this->customerMetadata->getAttributeMetadata(self::$genderAttributeCode);
138 }
catch (NoSuchEntityException $e) {
148 private function setCustomerGroupValue()
154 }
catch (NoSuchEntityException $e) {
164 private function setWebsiteValue()
167 $list = $this->storeManager->getWebsites();
177 private function setConfirmationValue()
181 $isConfirmationRequired = (bool)$this->scopeConfig->getValue(
182 AccountManagement::XML_PATH_IS_CONFIRM,
183 ScopeInterface::SCOPE_WEBSITES,
187 $valueText =
__(
'Confirmation Not Required');
188 if ($isConfirmationRequired) {
189 $valueText =
$value ===
null ?
__(
'Confirmed') :
__(
'Confirmation Required');
200 private function setAccountLockValue()
204 $valueText =
__(
'Unlocked');
206 $lockExpires = new \DateTime(
$value);
207 if ($lockExpires >
new \DateTime()) {
208 $valueText =
__(
'Locked');
setCustomAttribute($attributeCode, $attributeValue)
getData($key='', $index=null)
__construct(AttributeValueFactory $attributeValueFactory, GroupRepositoryInterface $groupRepository, CustomerMetadataInterface $customerMetadata, StoreManagerInterface $storeManager, ScopeConfigInterface $scopeConfig=null)
getCustomAttribute($attributeCode)