Config.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * Module Output Config Model
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Module\Output;
  9. /**
  10. * @deprecated 101.0.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
  11. * version. Module output can still be enabled/disabled in configuration files. However, this functionality should
  12. * not be used in future development. Module design should explicitly state dependencies to avoid requiring output
  13. * disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
  14. * issues that will be addressed in future releases.
  15. */
  16. class Config implements \Magento\Framework\Module\Output\ConfigInterface
  17. {
  18. /**
  19. * XPath in the configuration where module statuses are stored
  20. * @deprecated 100.2.0
  21. */
  22. const XML_PATH_MODULE_OUTPUT_STATUS = 'advanced/modules_disable_output/%s';
  23. /**
  24. * @var \Magento\Framework\App\Config\ScopeConfigInterface
  25. * @deprecated 101.0.0
  26. */
  27. protected $_scopeConfig;
  28. /**
  29. * @var string
  30. * @deprecated 101.0.0
  31. */
  32. protected $_storeType;
  33. /**
  34. * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  35. * @param string $scopeType
  36. */
  37. public function __construct(
  38. \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
  39. $scopeType
  40. ) {
  41. $this->_scopeConfig = $scopeConfig;
  42. $this->_storeType = $scopeType;
  43. }
  44. /**
  45. * Whether a module is enabled in the configuration or not
  46. *
  47. * @param string $moduleName Fully-qualified module name
  48. * @deprecated 101.0.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
  49. * version. Module output can still be enabled/disabled in configuration files. However, this functionality should
  50. * not be used in future development. Module design should explicitly state dependencies to avoid requiring output
  51. * disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
  52. * issues that will be addressed in future releases.
  53. * @return boolean
  54. */
  55. public function isEnabled($moduleName)
  56. {
  57. return $this->isSetFlag(sprintf(self::XML_PATH_MODULE_OUTPUT_STATUS, $moduleName));
  58. }
  59. /**
  60. * Retrieve module enabled specific path
  61. *
  62. * @param string $path Fully-qualified config path
  63. * @deprecated 101.0.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
  64. * version. Module output can still be enabled/disabled in configuration files. However, this functionality should
  65. * not be used in future development. Module design should explicitly state dependencies to avoid requiring output
  66. * disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
  67. * issues that will be addressed in future releases.
  68. * @return boolean
  69. */
  70. public function isSetFlag($path)
  71. {
  72. return $this->_scopeConfig->isSetFlag($path, $this->_storeType);
  73. }
  74. }