Edit.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CheckoutAgreements\Block\Adminhtml\Agreement;
  7. class Edit extends \Magento\Backend\Block\Widget\Form\Container
  8. {
  9. /**
  10. * Core registry
  11. *
  12. * @var \Magento\Framework\Registry
  13. */
  14. protected $_coreRegistry = null;
  15. /**
  16. * @param \Magento\Backend\Block\Widget\Context $context
  17. * @param \Magento\Framework\Registry $registry
  18. * @param array $data
  19. * @codeCoverageIgnore
  20. */
  21. public function __construct(
  22. \Magento\Backend\Block\Widget\Context $context,
  23. \Magento\Framework\Registry $registry,
  24. array $data = []
  25. ) {
  26. $this->_coreRegistry = $registry;
  27. parent::__construct($context, $data);
  28. }
  29. /**
  30. * Init class
  31. *
  32. * @return void
  33. */
  34. protected function _construct()
  35. {
  36. $this->_objectId = 'id';
  37. $this->_controller = 'adminhtml_agreement';
  38. $this->_blockGroup = 'Magento_CheckoutAgreements';
  39. parent::_construct();
  40. $this->buttonList->update('save', 'label', __('Save Condition'));
  41. $this->buttonList->update('delete', 'label', __('Delete Condition'));
  42. }
  43. /**
  44. * Get Header text
  45. *
  46. * @return \Magento\Framework\Phrase
  47. */
  48. public function getHeaderText()
  49. {
  50. if ($this->_coreRegistry->registry('checkout_agreement')->getId()) {
  51. return __('Edit Terms and Conditions');
  52. } else {
  53. return __('New Terms and Conditions');
  54. }
  55. }
  56. }