|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the adminbsb-material-design-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2017 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\AdminBSBBundle\Twig\Extension\Widget; |
|
13
|
|
|
|
|
14
|
|
|
use Twig_Environment; |
|
15
|
|
|
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractTwigExtension; |
|
16
|
|
|
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AdminBSBRendererTwigExtension; |
|
17
|
|
|
use WBW\Bundle\BootstrapBundle\Twig\Extension\CSS\TypographyTwigExtension; |
|
18
|
|
|
use WBW\Bundle\BootstrapBundle\Twig\Extension\CSS\TypographyTwigExtensionTrait; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Abstract card twig extension. |
|
22
|
|
|
* |
|
23
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
24
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\Widget |
|
25
|
|
|
* @abstract |
|
26
|
|
|
*/ |
|
27
|
|
|
abstract class AbstractCardTwigExtension extends AbstractTwigExtension { |
|
28
|
|
|
|
|
29
|
|
|
use TypographyTwigExtensionTrait; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Constructor. |
|
33
|
|
|
* |
|
34
|
|
|
* @param Twig_Environment $twigEnvironment The Twig environment. |
|
35
|
|
|
* @param TypographyTwigExtension $typographyTwigExtension The typography. |
|
36
|
|
|
*/ |
|
37
|
|
|
protected function __construct(Twig_Environment $twigEnvironment, TypographyTwigExtension $typographyTwigExtension) { |
|
38
|
|
|
parent::__construct($twigEnvironment); |
|
39
|
|
|
$this->setTypographyTwigExtension($typographyTwigExtension); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Displays an AdminBSB card header. |
|
44
|
|
|
* |
|
45
|
|
|
* @param string $content The content. |
|
46
|
|
|
* @param string $description The description. |
|
47
|
|
|
* @param string $icon The icon. |
|
48
|
|
|
* @return string Returns the AdminBSB card header. |
|
49
|
|
|
*/ |
|
50
|
|
|
protected function adminBSBCardHeader($content, $description, $icon) { |
|
51
|
|
|
|
|
52
|
|
|
// Initialize the parameters. |
|
53
|
|
|
$innerHTML = $content; |
|
54
|
|
|
if (null !== $description) { |
|
55
|
|
|
$innerHTML .= static::coreHTMLElement("small", $description); |
|
56
|
|
|
} |
|
57
|
|
|
if (null !== $icon) { |
|
58
|
|
|
$innerHTML = AdminBSBRendererTwigExtension::renderIcon($icon, "margin: -4px 4px 0 0; vertical-align: sub;") . $innerHTML; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
// Return the HTML. |
|
62
|
|
|
return $this->getTypography()->bootstrapHeading2Function(["class" => "card-header", "content" => $innerHTML]); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.