I was required to manage custom core_config_data (system config) values with a separate form from the Magento Admin side. How I can retrieve the values saved in the table with the data provider?

2 Answers 2

$this->scopeConfig->getValue('general/locale/timezone', ScopeInterface::SCOPE_WEBSITE);

where general/locale/timezone is the config path to adapt and scopeConfig is an instance of Magento\Framework\App\Config\ScopeConfigInterface;


Are you talking custom core_config_data table value? if Yes then I would suggest two options:

  1. Using defining the model and call modelFatory in block you can get custom table data:
public function __construct(
    Context $context,
    \Namespace\Module\Model\ModuleFactory $modelFactory,

    array $data = array()
) {
    $this->_modelFactory = $modelFactory;
    parent::__construct($context, $data);

You can get collection by factory methods:

public function getCollection(){

    return $this->_modelFactory->create()->getCollection();


Reference website: https://magefan.com/blog/load-data-from--magento-2-database

  1. Without a Model, you can use a direct connection object and gettable data using a select query.

namespace Venodr\ModuleName\Model;

use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\EntityManager\Operation\ExtensionInterface;

class CustomData
    protected $connection;

    public function __construct(
        \Magento\Framework\App\ResourceConnection $resource
        $this->connection = $resource->getConnection();

    public function getQueryData()
        $query = $this->connection->fetchAll("SELECT * FROM custom_core_config_data");
        return $query;

Please let me know if this will not help.

  • Thanks for your response, Unfortunately, it does not meet my requirement. I just need create a magento2 admin ui form with core_config_data table values to set up a custom settings page. However, I was managed it with custom dataprovider with Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory
    – ajay
    Nov 30, 2021 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.