Skip to content

Commit ad67fc5

Browse files
committed
Create emulateAreaCode.php
1 parent df8637e commit ad67fc5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

emulateAreaCode.php

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

0 commit comments

Comments
 (0)