StaticFile.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Design\FileResolution\Fallback;
  7. use Magento\Framework\View\Design\ThemeInterface;
  8. /**
  9. * Provider of static view files
  10. */
  11. class StaticFile
  12. {
  13. /**
  14. * @var ResolverInterface
  15. */
  16. private $resolver;
  17. /**
  18. * Constructor
  19. *
  20. * @param ResolverInterface $resolver
  21. */
  22. public function __construct(ResolverInterface $resolver)
  23. {
  24. $this->resolver = $resolver;
  25. }
  26. /**
  27. * Get a static view file name, using fallback mechanism
  28. *
  29. * @param string $area
  30. * @param ThemeInterface $themeModel
  31. * @param string $locale
  32. * @param string $file
  33. * @param string|null $module
  34. * @return string|bool
  35. */
  36. public function getFile($area, ThemeInterface $themeModel, $locale, $file, $module = null)
  37. {
  38. return $this->resolver->resolve($this->getFallbackType(), $file, $area, $themeModel, $locale, $module);
  39. }
  40. /**
  41. * @return string
  42. */
  43. protected function getFallbackType()
  44. {
  45. return \Magento\Framework\View\Design\Fallback\RulePool::TYPE_STATIC_FILE;
  46. }
  47. }