Currencysymbol.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Manage currency symbols block
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\CurrencySymbol\Block\Adminhtml\System;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. class Currencysymbol extends \Magento\Backend\Block\Widget\Form
  17. {
  18. /**
  19. * @var \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory
  20. */
  21. protected $_symbolSystemFactory;
  22. /**
  23. * @param \Magento\Backend\Block\Template\Context $context
  24. * @param \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolSystemFactory
  25. * @param array $data
  26. */
  27. public function __construct(
  28. \Magento\Backend\Block\Template\Context $context,
  29. \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolSystemFactory,
  30. array $data = []
  31. ) {
  32. $this->_symbolSystemFactory = $symbolSystemFactory;
  33. parent::__construct($context, $data);
  34. }
  35. /**
  36. * Constructor. Initialization required variables for class instance.
  37. *
  38. * @return void
  39. */
  40. protected function _construct()
  41. {
  42. $this->_controller = 'adminhtml_system_currencysymbol';
  43. parent::_construct();
  44. }
  45. /**
  46. * Custom currency symbol properties
  47. *
  48. * @var array
  49. */
  50. protected $_symbolsData = [];
  51. /**
  52. * Prepares layout
  53. *
  54. * @return \Magento\Framework\View\Element\AbstractBlock
  55. */
  56. protected function _prepareLayout()
  57. {
  58. $this->getToolbar()->addChild(
  59. 'save_button',
  60. \Magento\Backend\Block\Widget\Button::class,
  61. [
  62. 'label' => __('Save Currency Symbols'),
  63. 'class' => 'save primary save-currency-symbols',
  64. 'data_attribute' => [
  65. 'mage-init' => ['button' => ['event' => 'save', 'target' => '#currency-symbols-form']],
  66. ]
  67. ]
  68. );
  69. return parent::_prepareLayout();
  70. }
  71. /**
  72. * Returns page header
  73. *
  74. * @return \Magento\Framework\Phrase
  75. * @codeCoverageIgnore
  76. */
  77. public function getHeader()
  78. {
  79. return __('Currency Symbols');
  80. }
  81. /**
  82. * Returns URL for save action
  83. *
  84. * @return string
  85. * @codeCoverageIgnore
  86. */
  87. public function getFormActionUrl()
  88. {
  89. return $this->getUrl('adminhtml/*/save');
  90. }
  91. /**
  92. * Returns website id
  93. *
  94. * @return int
  95. * @codeCoverageIgnore
  96. */
  97. public function getWebsiteId()
  98. {
  99. return $this->getRequest()->getParam('website');
  100. }
  101. /**
  102. * Returns store id
  103. *
  104. * @return int
  105. * @codeCoverageIgnore
  106. */
  107. public function getStoreId()
  108. {
  109. return $this->getRequest()->getParam('store');
  110. }
  111. /**
  112. * Returns Custom currency symbol properties
  113. *
  114. * @return array
  115. */
  116. public function getCurrencySymbolsData()
  117. {
  118. if (!$this->_symbolsData) {
  119. $this->_symbolsData = $this->_symbolSystemFactory->create()->getCurrencySymbolsData();
  120. }
  121. return $this->_symbolsData;
  122. }
  123. /**
  124. * Returns inheritance text
  125. *
  126. * @return \Magento\Framework\Phrase
  127. * @codeCoverageIgnore
  128. */
  129. public function getInheritText()
  130. {
  131. return __('Use Standard');
  132. }
  133. }