1 | <?php |
||
26 | class RoleLabelUtilityTwigExtension extends AbstractUtilityTwigExtension { |
||
27 | |||
28 | /** |
||
29 | * Service name. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | const SERVICE_NAME = "webeweb.bundle.bootstrapbundle.twig.extension.utility.rolelabel"; |
||
34 | |||
35 | /** |
||
36 | * Extension. |
||
37 | * |
||
38 | * @var LabelComponentTwigExtension |
||
39 | */ |
||
40 | private $extension; |
||
41 | |||
42 | /** |
||
43 | * Translator. |
||
44 | * |
||
45 | * @var TranslatorInterface |
||
46 | */ |
||
47 | private $translator; |
||
48 | |||
49 | /** |
||
50 | * Constructor. |
||
51 | * |
||
52 | * @param LabelComponentTwigExtension $extension The label component Twig extension. |
||
53 | */ |
||
54 | public function __construct(TranslatorInterface $translator, LabelComponentTwigExtension $extension) { |
||
59 | |||
60 | /** |
||
61 | * Apply the color. |
||
62 | * |
||
63 | * @param string $label The label. |
||
64 | * @param string $content The content. |
||
65 | * @param string $color The color. |
||
66 | * @return string Returns the label with applied color. |
||
67 | */ |
||
68 | private function applyColor($label, $content, $color) { |
||
75 | |||
76 | /** |
||
77 | * Display a Bootstrap role label. |
||
78 | * |
||
79 | * @param UserInterface $user The user. |
||
80 | * @param array $roleColors The role colors. |
||
81 | * @param array $roleTrans The role translations. |
||
82 | * @return string Returns the Bootstrap role label. |
||
83 | */ |
||
84 | public function bootstrapRoleLabelFunction(UserInterface $user = null, array $roleColors = [], array $roleTrans = []) { |
||
116 | |||
117 | /** |
||
118 | * Get the Twig functions. |
||
119 | * |
||
120 | * @return array Returns the Twig functions. |
||
121 | */ |
||
122 | public function getFunctions() { |
||
127 | |||
128 | } |
||
129 |