Completed
Push — master ( 10f697...c17cc0 )
by WEBEWEB
02:43
created

AbstractModalTwigExtension::getTypography()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the adminbsb-material-design-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\AdminBSBBundle\Twig\Extension\UI;
13
14
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension;
15
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AdminBSBRendererTwigExtension;
16
use WBW\Bundle\AdminBSBBundle\Twig\Extension\Widget\AbstractCardTwigExtension;
17
use WBW\Bundle\BootstrapBundle\Twig\Extension\CSS\TypographyTwigExtension;
18
19
/**
20
 * Abstract modal Twig extension.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI
24
 * @abstract
25
 */
26
abstract class AbstractModalTwigExtension extends AbstractAdminBSBTwigExtension {
27
28
    /**
29
     * Typography.
30
     *
31
     * @var TypographyTwigExtension
32
     */
33
    private $typography;
34
35
    /**
36
     * Constructor.
37
     *
38
     * @param TypographyTwigExtension $typography The typography.
39
     */
40
    protected function __construct(TypographyTwigExtension $typography) {
41
        parent::__construct();
42
        $this->setTypography($typography);
43
    }
44
45
    /**
46
     * Displays an AdminBSB modal header.
47
     *
48
     * @param string $content The content.
49
     * @param string $icon The icon.
50
     * @return string Returns the AdminBSB modal header.
51
     */
52
    protected function adminBSBModalHeader($content, $icon) {
53
54
        // Initialize the parameters.
55
        $innerHTML = $content;
56
        if (null !== $icon) {
57
            $innerHTML = AdminBSBRendererTwigExtension::renderIcon($icon, "margin: -4px 0; vertical-align: sub;") . $innerHTML;
58
        }
59
60
        // Return the HTML.
61
        return $this->getTypography()->bootstrapHeading3Function(["class" => "modal-title", "content" => $innerHTML]);
62
    }
63
64
    /**
65
     * Get the typography.
66
     *
67
     * @return TypographyTwigExtension Returns the typography.
68
     */
69
    public function getTypography() {
70
        return $this->typography;
71
    }
72
73
    /**
74
     * Set the typography.
75
     *
76
     * @param TypographyTwigExtension $typography The typography.
77
     * @return AbstractCardTwigExtension Returns this card Twig extension.
78
     */
79
    protected function setTypography(TypographyTwigExtension $typography) {
80
        $this->typography = $typography;
81
        return $this;
82
    }
83
84
}
85