_registry = $registry; $this->_logger = $logger; $this->_integrationService = $integrationService; $this->_oauthService = $oauthService; $this->jsonHelper = $jsonHelper; $this->_integrationData = $integrationData; $this->escaper = $escaper; $this->_integrationCollection = $integrationCollection; parent::__construct($context); } /** * Don't actually redirect if we've got AJAX request - return redirect URL instead. * * @param string $path * @param array $arguments * @return $this|\Magento\Backend\App\AbstractAction */ protected function _redirect($path, $arguments = []) { if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->representJson( $this->jsonHelper->jsonEncode(['_redirect' => $this->getUrl($path, $arguments)]) ); return $this; } else { return parent::_redirect($path, $arguments); } } /** * Restore saved form resources * * @return void */ protected function restoreResourceAndSaveToRegistry() { $restoredFormData = $this->_getSession()->getIntegrationData(); if ($restoredFormData) { $resource = isset($restoredFormData['resource']) ? $restoredFormData['resource'] : []; $this->_registry->register( self::REGISTRY_KEY_CURRENT_RESOURCE, ['all_resources' => $restoredFormData['all_resources'], 'resource' => $resource] ); } } }