AbstractAction.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ui\Controller\Adminhtml;
  7. use Magento\Backend\App\Action;
  8. use Magento\Backend\App\Action\Context;
  9. use Magento\Ui\Controller\UiActionInterface;
  10. use Magento\Framework\View\Element\UiComponentFactory;
  11. /**
  12. * Class Render
  13. * @api
  14. * @since 100.0.2
  15. */
  16. abstract class AbstractAction extends Action implements UiActionInterface
  17. {
  18. /**
  19. * @var UiComponentFactory
  20. */
  21. protected $factory;
  22. /**
  23. * @param Context $context
  24. * @param UiComponentFactory $factory
  25. */
  26. public function __construct(Context $context, UiComponentFactory $factory)
  27. {
  28. parent::__construct($context);
  29. $this->factory = $factory;
  30. }
  31. /**
  32. * Getting name
  33. *
  34. * @return mixed
  35. */
  36. protected function getName()
  37. {
  38. return $this->_request->getParam('name');
  39. }
  40. /**
  41. * Getting component
  42. *
  43. * @return mixed
  44. */
  45. protected function getComponent()
  46. {
  47. return $this->_request->getParam('component');
  48. }
  49. /**
  50. * Action for AJAX request
  51. *
  52. * @return void
  53. */
  54. public function executeAjaxRequest()
  55. {
  56. $this->execute();
  57. }
  58. /**
  59. * @return bool
  60. */
  61. protected function _isAllowed()
  62. {
  63. return true;
  64. }
  65. }