SchemaLocator.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Locator for widget XSD schemas.
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Widget\Model\Config;
  9. use Magento\Framework\Module\Dir;
  10. class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
  11. {
  12. /**
  13. * Path to corresponding XSD file with validation rules for merged config
  14. *
  15. * @var string
  16. */
  17. protected $_schema = null;
  18. /**
  19. * Path to corresponding XSD file with validation rules for separate config files
  20. *
  21. * @var string
  22. */
  23. protected $_perFileSchema = null;
  24. /**
  25. * @param \Magento\Framework\Module\Dir\Reader $moduleReader
  26. */
  27. public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader)
  28. {
  29. $etcDir = $moduleReader->getModuleDir(\Magento\Framework\Module\Dir::MODULE_ETC_DIR, 'Magento_Widget');
  30. $this->_schema = $etcDir . '/widget.xsd';
  31. $this->_perFileSchema = $etcDir . '/widget_file.xsd';
  32. }
  33. /**
  34. * Get path to merged config schema
  35. *
  36. * @return string|null
  37. */
  38. public function getSchema()
  39. {
  40. return $this->_schema;
  41. }
  42. /**
  43. * Get path to per file validation schema
  44. *
  45. * @return string|null
  46. */
  47. public function getPerFileSchema()
  48. {
  49. return $this->_perFileSchema;
  50. }
  51. }