NewAction.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Integration\Controller\Adminhtml\Integration;
  8. use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
  9. class NewAction extends \Magento\Integration\Controller\Adminhtml\Integration implements HttpGetActionInterface
  10. {
  11. /**
  12. * New integration action.
  13. *
  14. * @return void
  15. */
  16. public function execute()
  17. {
  18. $this->restoreResourceAndSaveToRegistry();
  19. $this->_view->loadLayout();
  20. $this->_setActiveMenu('Magento_Integration::system_integrations');
  21. $this->_addBreadcrumb(__('New Integration'), __('New Integration'));
  22. $this->_view->getPage()->getConfig()->getTitle()->prepend(__('New Integration'));
  23. /** Try to recover integration data from session if it was added during previous request which failed. */
  24. $restoredIntegration = $this->_getSession()->getIntegrationData();
  25. if ($restoredIntegration) {
  26. $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $restoredIntegration);
  27. $this->_getSession()->setIntegrationData([]);
  28. }
  29. $this->_view->renderLayout();
  30. }
  31. }