diff --git a/Model/Config/Source/CustomerAttribute.php b/Model/Config/Source/CustomerAttribute.php new file mode 100644 index 0000000..2898e7e --- /dev/null +++ b/Model/Config/Source/CustomerAttribute.php @@ -0,0 +1,56 @@ +collectionFactory = $collectionFactory; + } + + /** + * @return array + */ + public function toOptionArray(): array + { + $collection = $this->collectionFactory + ->create() + ->setEntityTypeFilter(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER) + ->addOrder('frontend_label', 'ASC'); + + $result = [ + [ + 'value' => '', + 'label' => __('Select CPF attribute') + ] + ]; + + foreach ($collection as $item) { + $result[] = [ + 'value' => $item->getAttributeCode(), + 'label' => $item->getFrontendLabel() + ]; + } + + return $result; + } +} diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 6bf9f5f..e80fae4 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -20,7 +20,7 @@ - Intelipost\Quote\Model\Config\Source\Attribute + Intelipost\Push\Model\Config\Source\CustomerAttribute Select CPF attribute