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 WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension; |
15
|
|
|
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AdminBSBRendererTwigExtension; |
16
|
|
|
use WBW\Bundle\BootstrapBundle\Twig\Extension\CSS\TypographyTwigExtension; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Abstract card twig extension. |
20
|
|
|
* |
21
|
|
|
* @author webeweb <https://github.com/webeweb/> |
22
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Twig\Extension\Widget |
23
|
|
|
* @abstract |
24
|
|
|
*/ |
25
|
|
|
abstract class AbstractCardTwigExtension extends AbstractAdminBSBTwigExtension { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Typography. |
29
|
|
|
* |
30
|
|
|
* @var TypographyTwigExtension |
31
|
|
|
*/ |
32
|
|
|
private $typography; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Constructor. |
36
|
|
|
* |
37
|
|
|
* @param TypographyTwigExtension $typography The typography. |
38
|
|
|
*/ |
39
|
|
|
protected function __construct(TypographyTwigExtension $typography) { |
40
|
|
|
parent::__construct(); |
41
|
|
|
$this->setTypography($typography); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Displays an AdminBSB card header. |
46
|
|
|
* |
47
|
|
|
* @param string $content The content. |
48
|
|
|
* @param string $description The description. |
49
|
|
|
* @param string $icon The icon. |
50
|
|
|
* @return string Returns the AdminBSB card header. |
51
|
|
|
*/ |
52
|
|
|
protected function adminBSBCardHeader($content, $description, $icon) { |
53
|
|
|
|
54
|
|
|
// Initialize the parameters. |
55
|
|
|
$innerHTML = $content; |
56
|
|
|
if (null !== $description) { |
57
|
|
|
$innerHTML .= self::bootstrapHTMLElement("small", $description); |
|
|
|
|
58
|
|
|
} |
59
|
|
|
if (null !== $icon) { |
60
|
|
|
$innerHTML = AdminBSBRendererTwigExtension::renderIcon($icon, "margin: -4px 4px 0 0; vertical-align: sub;") . $innerHTML; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// Return the HTML. |
64
|
|
|
return $this->getTypography()->bootstrapHeading2Function(["class" => "card-header", "content" => $innerHTML]); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Get the typography. |
69
|
|
|
* |
70
|
|
|
* @return TypographyTwigExtension Returns the typography. |
71
|
|
|
*/ |
72
|
|
|
public function getTypography() { |
73
|
|
|
return $this->typography; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Set the typography. |
78
|
|
|
* |
79
|
|
|
* @param TypographyTwigExtension $typography The typography. |
80
|
|
|
* @return AbstractCardTwigExtension Returns this card Twig extension. |
81
|
|
|
*/ |
82
|
|
|
protected function setTypography(TypographyTwigExtension $typography) { |
83
|
|
|
$this->typography = $typography; |
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.