CustomCss.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Theme customization service class for custom css
  8. */
  9. namespace Magento\Theme\Model\Theme\Customization\File;
  10. class CustomCss extends \Magento\Framework\View\Design\Theme\Customization\AbstractFile
  11. {
  12. /**#@+
  13. * Custom CSS file type customization
  14. */
  15. const TYPE = 'custom_css';
  16. const CONTENT_TYPE = 'css';
  17. /**#@-*/
  18. /**
  19. * Default filename
  20. */
  21. const FILE_NAME = 'custom.css';
  22. /**
  23. * Default order position
  24. */
  25. const SORT_ORDER = 10;
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function getType()
  30. {
  31. return self::TYPE;
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function getContentType()
  37. {
  38. return self::CONTENT_TYPE;
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. protected function _prepareFileName(\Magento\Framework\View\Design\Theme\FileInterface $file)
  44. {
  45. if (!$file->getFileName()) {
  46. $file->setFileName(self::FILE_NAME);
  47. }
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. protected function _prepareSortOrder(\Magento\Framework\View\Design\Theme\FileInterface $file)
  53. {
  54. $file->setData('sort_order', self::SORT_ORDER);
  55. }
  56. }