Page.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Adminhtml page
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Backend\Block;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. class Page extends \Magento\Backend\Block\Template
  17. {
  18. /**
  19. * @var \Magento\Framework\Locale\ResolverInterface
  20. */
  21. protected $_localeResolver;
  22. /**
  23. * @param Template\Context $context
  24. * @param \Magento\Framework\Locale\ResolverInterface $localeResolver
  25. * @param array $data
  26. */
  27. public function __construct(
  28. \Magento\Backend\Block\Template\Context $context,
  29. \Magento\Framework\Locale\ResolverInterface $localeResolver,
  30. array $data = []
  31. ) {
  32. parent::__construct($context, $data);
  33. $this->_localeResolver = $localeResolver;
  34. }
  35. /**
  36. * Class constructor
  37. *
  38. * @return void
  39. */
  40. protected function _construct()
  41. {
  42. parent::_construct();
  43. $this->pageConfig->addBodyClass($this->_request->getFullActionName('-'));
  44. }
  45. /**
  46. * Get current language
  47. *
  48. * @return string
  49. */
  50. public function getLang()
  51. {
  52. if (!$this->hasData('lang')) {
  53. $this->setData('lang', substr($this->_localeResolver->getLocale(), 0, 2));
  54. }
  55. return $this->getData('lang');
  56. }
  57. /**
  58. * @return bool
  59. */
  60. public function isSingleStoreMode()
  61. {
  62. return $this->_storeManager->isSingleStoreMode();
  63. }
  64. }