1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the bootstrap-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\BootstrapBundle\Twig\Extension\CSS; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\BootstrapBundle\Twig\Extension\AbstractTwigExtension; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Abstract code Twig extension. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Bundle\BootstrapBundle\Twig\Extension\CSS |
21
|
|
|
* @abstract |
22
|
|
|
*/ |
23
|
|
|
abstract class AbstractCodeTwigExtension extends AbstractTwigExtension { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Displays a Bootstrap basic block. |
27
|
|
|
* |
28
|
|
|
* @param string $content The content. |
29
|
|
|
* @return string Returns the Bootstrap basic block. |
30
|
|
|
*/ |
31
|
|
|
protected function bootstrapBasicBlock($content) { |
32
|
|
|
return static::coreHTMLElement("pre", $content); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Displays a Bootstrap inline. |
37
|
|
|
* |
38
|
|
|
* @param string $content The inline content. |
39
|
|
|
* @return string Returns the Bootstrap inline. |
40
|
|
|
*/ |
41
|
|
|
protected function bootstrapInline($content) { |
42
|
|
|
return static::coreHTMLElement("code", $content); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Displays a Bootstrap sample output. |
47
|
|
|
* |
48
|
|
|
* @param string $content The content. |
49
|
|
|
* @return string Returns the Bootstrap sample output. |
50
|
|
|
*/ |
51
|
|
|
protected function bootstrapSampleOutput($content) { |
52
|
|
|
return static::coreHTMLElement("samp", $content); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Displays a Bootstrap user input. |
57
|
|
|
* |
58
|
|
|
* @param string $content The content. |
59
|
|
|
* @return string Returns the Bootstrap user input. |
60
|
|
|
*/ |
61
|
|
|
protected function bootstrapUserInput($content) { |
62
|
|
|
return static::coreHTMLElement("kbd", $content); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Displays a Bootstrap variable. |
67
|
|
|
* |
68
|
|
|
* @param string $content The content. |
69
|
|
|
* @return string Returns the Bootstrap variable. |
70
|
|
|
*/ |
71
|
|
|
protected function bootstrapVariable($content) { |
72
|
|
|
return static::coreHTMLElement("var", $content); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|