Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Edit.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
13 
15 {
21  public function execute()
22  {
24  $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID);
25  if ($integrationId) {
26  try {
27  $integrationData = $this->_integrationService->get($integrationId)->getData();
28  $originalName = $this->escaper->escapeHtml($integrationData[Info::DATA_NAME]);
29  } catch (IntegrationException $e) {
30  $this->messageManager->addError($this->escaper->escapeHtml($e->getMessage()));
31  $this->_redirect('*/*/');
32  return;
33  } catch (\Exception $e) {
34  $this->_logger->critical($e);
35  $this->messageManager->addError(__('Internal error. Check exception log for details.'));
36  $this->_redirect('*/*');
37  return;
38  }
39  $restoredIntegration = $this->_getSession()->getIntegrationData();
40  if ($restoredIntegration) {
41  $integrationData = array_merge($integrationData, $restoredIntegration);
42  }
43  } else {
44  $this->messageManager->addError(__('Integration ID is not specified or is invalid.'));
45  $this->_redirect('*/*/');
46  return;
47  }
48  $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData);
50  $this->_view->loadLayout();
51  $this->_getSession()->setIntegrationData([]);
52  $this->_setActiveMenu('Magento_Integration::system_integrations');
53 
54  if ($this->_integrationData->isConfigType($integrationData)) {
55  $title = __('View "%1" Integration', $originalName);
56  } else {
57  $title = __('Edit "%1" Integration', $originalName);
58  }
59 
60  $this->_addBreadcrumb($title, $title);
61  $this->_view->getPage()->getConfig()->getTitle()->prepend($title);
62  $this->_view->renderLayout();
63  }
64 }
$title
Definition: default.phtml:14
__()
Definition: __.php:13
_addBreadcrumb($label, $title, $link=null)