コード例 #1
0
ファイル: Js.php プロジェクト: Atlis/docker-magento2
 /**
  * Render js translation
  *
  * @return string
  */
 public function render()
 {
     $json = \Zend_Json::encode($this->dataProvider->getTranslateData());
     $this->translateInline->processResponseBody($json, false);
     $script = '(function($) {$.mage.translate.add(' . $json . ')})(jQuery);';
     return '<script type="text/javascript">//<![CDATA[' . "\n{$script}\n" . '//]]></script>';
 }
コード例 #2
0
 /**
  * @magentoAdminConfigFixture dev/translate_inline/active_admin 1
  * @covers \Magento\Framework\Translate\Inline::getAjaxUrl
  */
 public function testAjaxUrl()
 {
     $body = '<html><body>some body</body></html>';
     /** @var \Magento\Backend\Model\UrlInterface $url */
     $url = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\UrlInterface');
     $url->getUrl(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE . '/ajax/translate');
     $this->_translateInline->processResponseBody($body, true);
     $this->assertContains($url->getUrl(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE . '/ajax/translate'), $body);
 }
コード例 #3
0
ファイル: Layout.php プロジェクト: pradeep-wagento/magento2
 /**
  * Render current layout
  *
  * @param ResponseInterface $response
  * @return $this
  */
 protected function render(ResponseInterface $response)
 {
     $output = $this->layout->getOutput();
     $this->translateInline->processResponseBody($output);
     $response->appendBody($output);
     return $this;
 }
コード例 #4
0
ファイル: Onepage.php プロジェクト: nja78/magento2
 /**
  * Render HTML based on requested layout handle name
  *
  * @param string $handle
  * @return string
  */
 protected function _getHtmlByHandle($handle)
 {
     $layout = $this->layoutFactory->create();
     $layout->getUpdate()->load([$handle]);
     $layout->generateXml();
     $layout->generateElements();
     $output = $layout->getOutput();
     $this->_translateInline->processResponseBody($output);
     return $output;
 }
コード例 #5
0
ファイル: Onepage.php プロジェクト: Atlis/docker-magento2
 /**
  * Render HTML based on requested layout handle name
  *
  * @param string $handle
  * @return string
  */
 protected function _getHtmlByHandle($handle)
 {
     $layout = $this->_view->getLayout();
     $layout->getUpdate()->addPageHandles(array($handle));
     $layout->getUpdate()->load();
     $layout->generateXml();
     $layout->generateElements();
     $output = $layout->getOutput();
     $this->_translateInline->processResponseBody($output);
     return $output;
 }
コード例 #6
0
ファイル: View.php プロジェクト: Atlis/docker-magento2
 /**
  * Rendering layout
  *
  * @param   string $output
  * @return  $this
  */
 public function renderLayout($output = '')
 {
     if ($this->_actionFlag->get('', 'no-renderLayout')) {
         return $this;
     }
     \Magento\Framework\Profiler::start('LAYOUT');
     \Magento\Framework\Profiler::start('layout_render');
     if ('' !== $output) {
         $this->getLayout()->addOutputElement($output);
     }
     $this->_eventManager->dispatch('controller_action_layout_render_before');
     $this->_eventManager->dispatch('controller_action_layout_render_before_' . $this->_request->getFullActionName());
     $output = $this->getLayout()->getOutput();
     $this->_translateInline->processResponseBody($output);
     $this->_response->appendBody($output);
     \Magento\Framework\Profiler::stop('layout_render');
     \Magento\Framework\Profiler::stop('LAYOUT');
     return $this;
 }
コード例 #7
0
 /**
  * Encode the mixed $data into the JSON format.
  *
  * @param mixed $data
  * @return string
  */
 public function encode($data)
 {
     $json = \Zend_Json::encode($data);
     $this->translateInline->processResponseBody($json, true);
     return $json;
 }
コード例 #8
0
ファイル: Instance.php プロジェクト: shabbirvividads/magento2
 /**
  * Set body to response
  *
  * @param string $body
  * @return void
  */
 protected function setBody($body)
 {
     $this->_translateInline->processResponseBody($body);
     $this->getResponse()->setBody($body);
 }
コード例 #9
0
ファイル: Json.php プロジェクト: pradeep-wagento/magento2
 /**
  * {@inheritdoc}
  */
 protected function render(ResponseInterface $response)
 {
     $this->translateInline->processResponseBody($this->json, true);
     $response->representJson($this->json);
     return $this;
 }
コード例 #10
0
ファイル: Tabs.php プロジェクト: shabbirvividads/magento2
 /**
  * Translate html content
  *
  * @param string $html
  * @return string
  */
 protected function _translateHtml($html)
 {
     $this->_translateInline->processResponseBody($html);
     return $html;
 }
コード例 #11
0
ファイル: Encoder.php プロジェクト: Doability/magento2dev
 /**
  * Encode the mixed $data into the JSON format.
  *
  * @param mixed $data
  * @return string
  */
 public function encode($data)
 {
     $this->translateInline->processResponseBody($data);
     return \Zend_Json::encode($data);
 }