Passed
Push — master ( 2cc203...b4160e )
by Dmitrijs
02:52 queued 01:12
created

Html::endBlockquote()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/DMGPage/yii2-materialize
4
 * @copyright Copyright (c) 2018 Dmitrijs Reinmanis
5
 * @license https://github.com/DMGPage/yii2-materialize/blob/master/LICENSE
6
 */
7
8
namespace dmgpage\yii2materialize\helpers;
9
10
use yii\helpers\BaseHtml;
11
12
/**
13
 * Html is an enhanced version of [[\yii\helpers\Html]] helper class dedicated to the Materialize needs.
14
 * This class inherits all functionality available at [[\yii\helpers\Html]] and can be used as substitute.
15
 */
16
class Html extends BaseHtml
17
{
18
    /**
19
     * Generates a start tag for row.
20
     *
21
     * @param array $options the tag options in terms of name-value pairs. These will be rendered as
22
     * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
23
     * If a value is null, the corresponding attribute will not be rendered.
24
     * See [[renderTagAttributes()]] for details on how attributes are being rendered.
25
     *
26
     * @return string the generated start tag
27
     *
28
     * @see https://materializecss.com/grid.html
29
     * @see endGridRow()
30
     */
31
    public static function beginGridRow($options = [])
32
    {
33
        static::addCssClass($options, 'row');
34
        return static::beginTag('div', $options);
35
    }
36
37
    /**
38
     * Generates an end tag for row.
39
     *
40
     * @return string the generated end tag
41
     * @see beginGridRow()
42
     */
43
    public static function endGridRow()
44
    {
45
        return static::endTag('div');
46
    }
47
    
48
    /**
49
     * Generates a start tag for column.
50
     *
51
     * @param array $options the tag options in terms of name-value pairs. These will be rendered as
52
     * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
53
     * If a value is null, the corresponding attribute will not be rendered.
54
     * See [[renderTagAttributes()]] for details on how attributes are being rendered.
55
     *
56
     * @return string the generated start tag
57
     *
58
     * @see https://materializecss.com/grid.html
59
     * @see endGridCol()
60
     */
61
    public static function beginGridCol($options = [])
62
    {
63
        static::addCssClass($options, 'col');
64
        return static::beginTag('div', $options);
65
    }
66
    
67
    /**
68
     * Generates an end tag for column.
69
     *
70
     * @return string the generated end tag
71
     * @see beginGridCol()
72
     */
73
    public static function endGridCol()
74
    {
75
        return static::endTag('div');
76
    }
77
    
78
    /**
79
     * Generates a complete HTML tag for column.
80
     * 
81
     * @param string $content the content to be enclosed between the start and end tags. It will not be HTML-encoded.
82
     * If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
83
     * @param array $options the HTML tag attributes (HTML options) in terms of name-value pairs.
84
     * These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
85
     * If a value is null, the corresponding attribute will not be rendered.
86
     * See [[renderTagAttributes()]] for details on how attributes are being rendered.
87
     *
88
     * @return string the generated HTML tag
89
     * @see beginGridCol()
90
     * @see endGridCol()
91
     */
92
    public static function gridCol($content = '', $options = [])
93
    {
94
        static::addCssClass($options, 'col');
95
        return static::tag('div', $content, $options);
96
    }
97
98
    /**
99
     * Generates a start tag for blockquote.
100
     *
101
     * @param array $options the tag options in terms of name-value pairs. These will be rendered as
102
     * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
103
     * If a value is null, the corresponding attribute will not be rendered.
104
     * See [[renderTagAttributes()]] for details on how attributes are being rendered.
105
     *
106
     * @return string the generated start tag
107
     *
108
     * @see https://materializecss.com/typography.html
109
     * @see endBlockquote()
110
     */
111
    public static function beginBlockquote($options = [])
112
    {
113
        return static::beginTag('blockquote', $options);
114
    }
115
116
    /**
117
     * Generates an end tag for blockquote.
118
     *
119
     * @return string the generated end tag
120
     * @see beginBlockquote()
121
     */
122
    public static function endBlockquote()
123
    {
124
        return static::endTag('blockquote');
125
    }
126
127
    /**
128
     * Generates a complete HTML tag for blockquote.
129
     *
130
     * @param string $content the content to be enclosed between the start and end tags. It will not be HTML-encoded.
131
     * If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
132
     * @param array $options the HTML tag attributes (HTML options) in terms of name-value pairs.
133
     * These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
134
     * If a value is null, the corresponding attribute will not be rendered.
135
     * See [[renderTagAttributes()]] for details on how attributes are being rendered.
136
     *
137
     * @return string the generated HTML tag
138
     * @see beginBlockquote()
139
     * @see beginBlockquote()
140
     */
141
    public static function blockquote($content = '', $options = [])
142
    {
143
        return static::tag('blockquote', $content, $options);
144
    }
145
146
}
147