Edit.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Theme\Controller\Adminhtml\System\Design\Theme;
  8. /**
  9. * Class Edit
  10. * @deprecated 100.2.0
  11. */
  12. class Edit extends \Magento\Theme\Controller\Adminhtml\System\Design\Theme
  13. {
  14. /**
  15. * Edit theme
  16. *
  17. * @return void
  18. */
  19. public function execute()
  20. {
  21. $themeId = (int)$this->getRequest()->getParam('id');
  22. /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
  23. $theme = $this->_objectManager->create(\Magento\Framework\View\Design\ThemeInterface::class);
  24. try {
  25. $theme->setType(\Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL);
  26. if ($themeId && (!$theme->load($themeId)->getId() || !$theme->isVisible())) {
  27. throw new \Magento\Framework\Exception\LocalizedException(__('We cannot find theme "%1".', $themeId));
  28. }
  29. $this->_coreRegistry->register('current_theme', $theme);
  30. $this->_view->loadLayout();
  31. /** @var $tab \Magento\Theme\Block\Adminhtml\System\Design\Theme\Edit\Tab\Css */
  32. $tab = $this->_view->getLayout()->getBlock('theme_edit_tabs_tab_css_tab');
  33. if ($tab && $tab->canShowTab()) {
  34. /** @var $helper \Magento\Theme\Helper\Theme */
  35. $helper = $this->_objectManager->get(\Magento\Theme\Helper\Theme::class);
  36. $files = $helper->getCssAssets($theme);
  37. $tab->setFiles($files);
  38. }
  39. $this->_setActiveMenu('Magento_Theme::system_design_theme');
  40. $this->_view->renderLayout();
  41. } catch (\Magento\Framework\Exception\LocalizedException $e) {
  42. $this->messageManager->addError($e->getMessage());
  43. $this->_redirect('adminhtml/*/');
  44. } catch (\Exception $e) {
  45. $this->messageManager->addError(__('We cannot find the theme.'));
  46. $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
  47. $this->_redirect('adminhtml/*/');
  48. }
  49. }
  50. }