Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Index.php
Go to the documentation of this file.
1 <?php
8 
10 {
14  protected $inlineParser;
15 
20  public function __construct(
21  \Magento\Framework\App\Action\Context $context,
22  \Magento\Framework\Translate\Inline\ParserInterface $inlineParser
23  ) {
24  parent::__construct($context);
25 
26  $this->inlineParser = $inlineParser;
27  }
28 
34  public function execute()
35  {
36  $translate = (array)$this->getRequest()->getPost('translate');
37 
38  try {
39  $response = $this->inlineParser->processAjaxPost($translate);
40  } catch (\Exception $e) {
41  $response = "{error:true,message:'" . $e->getMessage() . "'}";
42  }
43  $this->getResponse()->representJson(json_encode($response));
44  $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
45  }
46 }
$response
Definition: 404.php:11
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\Translate\Inline\ParserInterface $inlineParser)
Definition: Index.php:20