ModalTwigExtension::adminBSBModalHeaderFunction()   A
last analyzed

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 1
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\UI;
13
14
use Twig\TwigFunction;
15
use WBW\Library\Core\Argument\Helper\ArrayHelper;
16
17
/**
18
 * Modal Twig extension.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI
22
 */
23
class ModalTwigExtension extends AbstractModalTwigExtension {
24
25
    /**
26
     * Service name.
27
     *
28
     * @var string
29
     */
30
    const SERVICE_NAME = "wbw.adminbsb.twig.extension.ui.modal";
31
32
    /**
33
     * Displays an AdminBSB modal header.
34
     *
35
     * @param array $args The arguments.
36
     * @return string Returns the AdminBSB modal header.
37
     */
38
    public function adminBSBModalHeaderFunction(array $args = []): string {
39
        return $this->adminBSBModalHeader(ArrayHelper::get($args, "content", ""), ArrayHelper::get($args, "icon"));
40
    }
41
42
    /**
43
     * Get the Twig functions.
44
     *
45
     * @return TwigFunction[] Returns the Twig functions.
46
     */
47
    public function getFunctions(): array {
48
        return [
49
            new TwigFunction("adminBSBModalHeader", [$this, "adminBSBModalHeaderFunction"], ["is_safe" => ["html"]]),
50
        ];
51
    }
52
}
53