Uploader.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content;
  7. /**
  8. * Files uploader block
  9. *
  10. * @api
  11. * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  12. * @since 100.0.2
  13. */
  14. class Uploader extends \Magento\Backend\Block\Media\Uploader
  15. {
  16. /**
  17. * Path to uploader template
  18. *
  19. * @var string
  20. */
  21. protected $_template = 'Magento_Theme::browser/content/uploader.phtml';
  22. /**
  23. * @var \Magento\Theme\Helper\Storage
  24. */
  25. protected $_storageHelper;
  26. /**
  27. * @param \Magento\Backend\Block\Template\Context $context
  28. * @param \Magento\Framework\File\Size $fileSize
  29. * @param \Magento\Theme\Helper\Storage $storageHelper
  30. * @param array $data
  31. */
  32. public function __construct(
  33. \Magento\Backend\Block\Template\Context $context,
  34. \Magento\Framework\File\Size $fileSize,
  35. \Magento\Theme\Helper\Storage $storageHelper,
  36. array $data = []
  37. ) {
  38. $this->_storageHelper = $storageHelper;
  39. parent::__construct($context, $fileSize, $data);
  40. }
  41. /**
  42. * Prepare layout
  43. *
  44. * @return \Magento\Backend\Block\Media\Uploader
  45. */
  46. protected function _prepareLayout()
  47. {
  48. $this->getConfig()->setUrl($this->getUrl('adminhtml/*/upload', $this->_storageHelper->getRequestParams()));
  49. return parent::_prepareLayout();
  50. }
  51. /**
  52. * Return storage helper
  53. *
  54. * @return \Magento\Theme\Helper\Storage
  55. */
  56. public function getHelperStorage()
  57. {
  58. return $this->_storageHelper;
  59. }
  60. }