Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Inline.php
Go to the documentation of this file.
1 <?php
9 
13 use Psr\Log\LoggerInterface;
14 
15 class Inline implements RendererInterface
16 {
20  protected $translator;
21 
25  protected $inlineProvider;
26 
30  protected $logger;
31 
37  public function __construct(
40  LoggerInterface $logger
41  ) {
42  $this->translator = $translator;
43  $this->inlineProvider = $inlineProvider;
44  $this->logger = $logger;
45  }
46 
56  public function render(array $source, array $arguments)
57  {
58  $text = end($source);
59 
60  try {
61  if (!$this->inlineProvider->get()->isAllowed()) {
62  return $text;
63  }
64 
65  if (strpos($text, '{{{') === false
66  || strpos($text, '}}}') === false
67  || strpos($text, '}}{{') === false
68  ) {
69  $text = '{{{'
70  . implode('}}{{', array_reverse($source))
71  . '}}{{' . $this->translator->getTheme() . '}}}';
72  }
73  } catch (\Exception $e) {
74  $this->logger->critical($e->getMessage());
75  throw $e;
76  }
77 
78  return $text;
79  }
80 }
return false
Definition: gallery.phtml:36
$source
Definition: source.php:23
render(array $source, array $arguments)
Definition: Inline.php:56
endifif( $block->getLastPageNum()>1)( 'Page') ?></strong >< ul class $text
Definition: pager.phtml:43
__construct(TranslateInterface $translator, ProviderInterface $inlineProvider, LoggerInterface $logger)
Definition: Inline.php:37