Edit.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Block\Adminhtml\Term;
  7. /**
  8. * Admin term edit block
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Edit extends \Magento\Backend\Block\Widget\Form\Container
  14. {
  15. /**
  16. * Core registry
  17. *
  18. * @var \Magento\Framework\Registry
  19. */
  20. protected $coreRegistry;
  21. /**
  22. * @param \Magento\Backend\Block\Widget\Context $context
  23. * @param \Magento\Framework\Registry $registry
  24. * @param array $data
  25. */
  26. public function __construct(
  27. \Magento\Backend\Block\Widget\Context $context,
  28. \Magento\Framework\Registry $registry,
  29. array $data = []
  30. ) {
  31. $this->coreRegistry = $registry;
  32. parent::__construct($context, $data);
  33. }
  34. /**
  35. * @return void
  36. */
  37. protected function _construct()
  38. {
  39. $this->_objectId = 'id';
  40. $this->_blockGroup = 'Magento_Search';
  41. $this->_controller = 'adminhtml_term';
  42. parent::_construct();
  43. $this->buttonList->update('save', 'label', __('Save Search'));
  44. $this->buttonList->update('delete', 'label', __('Delete Search'));
  45. }
  46. /**
  47. * @return \Magento\Framework\Phrase
  48. */
  49. public function getHeaderText()
  50. {
  51. if ($this->coreRegistry->registry('current_catalog_search')->getId()) {
  52. $queryText = $this->escapeHtml($this->coreRegistry->registry('current_catalog_search')->getQueryText());
  53. return __("Edit Search '%1'", $queryText);
  54. } else {
  55. return __('New Search');
  56. }
  57. }
  58. }