<?php
namespace Namespace\ModuleName\Model\System\Config\Source\Dropdown;
class Frontend implements \Magento\Framework\Option\ArrayInterface {
protected $_groupCollectionFactory;
public function __construct(\Magento\Customer\Model\ResourceModel\Group\CollectionFactory $groupCollectionFactory)
{
$this->_groupCollectionFactory = $groupCollectionFactory;
}
public function toOptionArray()
{
$this->_options = array();
if (!$this->_options) {
$this->_options = $this->_groupCollectionFactory->create()->loadData()->toOptionArray();
}
return $this->_options;
}
}
namespace Namespace\ModuleName\Model\System\Config\Source\Dropdown;
class Frontend implements \Magento\Framework\Option\ArrayInterface {
protected $_groupCollectionFactory;
public function __construct(\Magento\Customer\Model\ResourceModel\Group\CollectionFactory $groupCollectionFactory)
{
$this->_groupCollectionFactory = $groupCollectionFactory;
}
public function toOptionArray()
{
$this->_options = array();
if (!$this->_options) {
$this->_options = $this->_groupCollectionFactory->create()->loadData()->toOptionArray();
}
return $this->_options;
}
}