Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Reports\Model;
7 
9 
16 {
20  protected $_moduleReader;
21 
25  protected $_storeManager;
26 
32  public function __construct(
33  \Magento\Framework\Module\Dir\Reader $moduleReader,
34  \Magento\Store\Model\StoreManagerInterface $storeManager,
35  array $data = []
36  ) {
37  parent::__construct($data);
38  $this->_moduleReader = $moduleReader;
39  $this->_storeManager = $storeManager;
40  }
41 
47  public function getGlobalConfig()
48  {
49  $dom = new \DOMDocument();
50  $dom->load($this->_moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Reports') . '/flexConfig.xml');
51 
52  $baseUrl = $dom->createElement('baseUrl');
53  $baseUrl->nodeValue = $this->_storeManager->getBaseUrl();
54 
55  $dom->documentElement->appendChild($baseUrl);
56 
57  return $dom->saveXML();
58  }
59 
65  public function getLanguage()
66  {
67  return file_get_contents(
68  $this->_moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Reports') . '/flexLanguage.xml'
69  );
70  }
71 
77  public function getDashboard()
78  {
79  return file_get_contents(
80  $this->_moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Reports') . '/flexDashboard.xml'
81  );
82  }
83 }
$storeManager
__construct(\Magento\Framework\Module\Dir\Reader $moduleReader, \Magento\Store\Model\StoreManagerInterface $storeManager, array $data=[])
Definition: Config.php:32