Block.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ui\Component\Wrapper;
  7. use Magento\Framework\View\Element\BlockInterface;
  8. use Magento\Framework\View\Element\UiComponent\ContextInterface;
  9. use Magento\Ui\Component\AbstractComponent;
  10. use Magento\Framework\View\Element\UiComponent\BlockWrapperInterface;
  11. /**
  12. * @deprecated 101.0.0
  13. */
  14. class Block extends AbstractComponent implements BlockWrapperInterface
  15. {
  16. const NAME = 'blockWrapper';
  17. /**
  18. * @var BlockInterface
  19. */
  20. protected $block;
  21. /**
  22. * Constructor
  23. *
  24. * @param ContextInterface $context
  25. * @param BlockInterface $block
  26. * @param array $components
  27. * @param array $data
  28. */
  29. public function __construct(
  30. ContextInterface $context,
  31. BlockInterface $block,
  32. array $components = [],
  33. array $data = []
  34. ) {
  35. $this->block = $block;
  36. parent::__construct($context, $components, $data);
  37. }
  38. /**
  39. * Get wrapped block
  40. *
  41. * @return BlockInterface
  42. */
  43. public function getBlock()
  44. {
  45. return $this->block;
  46. }
  47. /**
  48. * Get component name
  49. *
  50. * @return string
  51. */
  52. public function getComponentName()
  53. {
  54. return static::NAME;
  55. }
  56. /**
  57. * @return string
  58. */
  59. public function render()
  60. {
  61. return $this->block->toHtml();
  62. }
  63. /**
  64. * {@inheritdoc}
  65. */
  66. public function getConfiguration()
  67. {
  68. return array_merge(
  69. (array) $this->block->getData('config'),
  70. (array) $this->getData('config')
  71. );
  72. }
  73. }