Skip to content

Boost your conversion rate

Davor Minchorov

Co-Founder / CTO

dsasdadsdadasdadada

PHP
1<?php
2 
3namespace App\Tags;
4 
5use Statamic\Tags\Tags;
6use Torchlight\Blade\BladeManager;
7use Torchlight\Block;
8 
9class Torchlight extends Tags
10{
11 /**
12 * {{ torchlight language="php" }}{{ my_code }}{{ /torchlight }}
13 */
14 public function index()
15 {
16 $language = $this->params->get('language');
17 $code = $this->context->raw('code');
18 
19 $block = Block::make()
20 ->language($language)
21 ->code($code)
22 ->theme(config('torchlight.theme'));
23 
24 BladeManager::registerBlock($block);
25 
26 $render = function (Block $block) {
27 return "<pre><code class='{$block->placeholder('classes')}' style='{$block->placeholder('styles')}'>{$block->placeholder()}</code></pre>";
28 };
29 
30 return $render($block);
31 }
32}