SignUp.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Controller\Adminhtml\BIEssentials;
  7. use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
  8. use Magento\Backend\App\Action;
  9. use Magento\Backend\App\Action\Context;
  10. use Magento\Framework\App\Config\ScopeConfigInterface;
  11. /**
  12. * Provides link to BI Essentials signup
  13. */
  14. class SignUp extends Action implements HttpGetActionInterface
  15. {
  16. /**
  17. * Path to config value with URL to BI Essentials sign-up page.
  18. *
  19. * @var string
  20. */
  21. private $urlBIEssentialsConfigPath = 'analytics/url/bi_essentials';
  22. /**
  23. * @var ScopeConfigInterface
  24. */
  25. private $config;
  26. /**
  27. * @inheritdoc
  28. */
  29. const ADMIN_RESOURCE = 'Magento_Analytics::bi_essentials';
  30. /**
  31. * @param Context $context
  32. * @param ScopeConfigInterface $config
  33. */
  34. public function __construct(
  35. Context $context,
  36. ScopeConfigInterface $config
  37. ) {
  38. $this->config = $config;
  39. parent::__construct($context);
  40. }
  41. /**
  42. * Provides link to BI Essentials signup
  43. *
  44. * @return \Magento\Framework\Controller\AbstractResult
  45. */
  46. public function execute()
  47. {
  48. return $this->resultRedirectFactory->create()->setUrl(
  49. $this->config->getValue($this->urlBIEssentialsConfigPath)
  50. );
  51. }
  52. }