-
Notifications
You must be signed in to change notification settings - Fork 6
/
emulateAreaCode.php
36 lines (28 loc) · 1.34 KB
/
emulateAreaCode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
ini_set('display_startup_errors', 1);ini_set('display_errors', 1); error_reporting(-1);
use Magento\Theme\Model\Theme\Collection;
use Magento\Framework\App\Area;
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class changeConfig extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$appState = $objectManager->get('Magento\Framework\App\State');
$field = $appState->emulateAreaCode('adminhtml', function($path){
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$appState = $objectManager->get('Magento\Framework\App\State');
$appState->setAreaCode('adminhtml');
$field = $objectManager->create('Magento\Config\Model\Config\Structure')
->getElementByConfigPath($path);
return $field;
}, ['customer/create_account/auto_group_assign']);
echo $field->getData()['source_model'];
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('changeConfig');
$bootstrap->run($app);