Пример #1
0
 /**
  * Set template data to retrieve it in template info form
  *
  * @return void
  */
 public function execute()
 {
     $this->_view->loadLayout();
     $template = $this->_initTemplate('id');
     $templateId = $this->getRequest()->getParam('code');
     try {
         $parts = $this->emailConfig->parseTemplateIdParts($templateId);
         $templateId = $parts['templateId'];
         $theme = $parts['theme'];
         if ($theme) {
             $template->setForcedTheme($templateId, $theme);
         }
         $template->setForcedArea($templateId);
         $template->loadDefault($templateId);
         $template->setData('orig_template_code', $templateId);
         $template->setData('template_variables', \Zend_Json::encode($template->getVariablesOptionArray(true)));
         $templateBlock = $this->_view->getLayout()->createBlock('Magento\\Email\\Block\\Adminhtml\\Template\\Edit');
         $template->setData('orig_template_currently_used_for', $templateBlock->getCurrentlyUsedForPaths(false));
         $this->getResponse()->representJson($this->_objectManager->get('Magento\\Framework\\Json\\Helper\\Data')->jsonEncode($template->getData()));
     } catch (\Exception $e) {
         $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
     }
 }
Пример #2
0
 /**
  * @dataProvider parseTemplateCodePartsDataProvider
  *
  * @param string $input
  * @param array $expectedOutput
  */
 public function testParseTemplateIdParts($input, $expectedOutput)
 {
     $this->assertEquals($this->model->parseTemplateIdParts($input), $expectedOutput);
 }