You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-13Lines changed: 36 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,39 +6,42 @@
6
6
7
7
----
8
8
9
-
This is the current, actively developed 3.x branch which is implementing Materialize version 1.0 and thus breaking backwards compatibility.
9
+
This is the current, actively developed 4.x branch which is implementing Materialize version 1.1 and thus breaking backwards compatibility.
10
10
11
11
[Go to 1.x version](https://github.com/MacGyer/yii2-materializecss/tree/1.x)
12
12
13
13
[Go to 2.x version](https://github.com/MacGyer/yii2-materializecss/tree/2.x)
14
14
15
+
[Go to 3.x version](https://github.com/MacGyer/yii2-materializecss/tree/3.x)
16
+
15
17
----
16
18
17
19
This package integrates the Materialize CSS framework into [Yii2](http://www.yiiframework.com/).
18
-
[Materialize](http://materializecss.com/) is a modern responsive front-end framework based on Material Design.
19
-
20
-
See [official documentation](http://macgyer.github.io/yii2-materializecss/) for detailed information.
20
+
[Materialize](https://materializecss.github.io/materialize/) is a modern responsive front-end framework based on Material Design.
21
21
22
-
Have a look at the [official demo page](https://yii2-materializecss.pluspunkt-coding.de) to see the repo in action (needs adaption to v3)
22
+
Have a look at the [official documentation page](https://yii2-materializecss.pluspunkt-coding.de) to see the repo in action (v4 only).
23
23
24
-
Current Materialize version implemented: 1.0.0.
24
+
Current Materialize version implemented: 1.1.0.
25
25
26
26
## Installation
27
27
28
28
The preferred way of installation is through Composer.
29
29
If you don't have Composer you can get it here: https://getcomposer.org/
30
30
31
-
You also should install the Composer Asset Plugin to handle NPM and Bower assets:
32
-
```
33
-
$ composer global require "fxp/composer-asset-plugin:~1.4"
31
+
You also should reference Asset Packagist in the ```repositories``` section to handle NPM and Bower assets:
32
+
```json
33
+
"repositories": [
34
+
{
35
+
"type": "composer",
36
+
"url": "https://asset-packagist.org"
37
+
}
38
+
]
34
39
```
35
40
36
-
Or you can make use of Asset Packagist: <https://asset-packagist.org/>
37
-
38
41
To install the package add the following to the ```require``` section of your composer.json:
39
-
```
42
+
```json
40
43
"require": {
41
-
"macgyer/yii2-materializecss": "~3.0.0"
44
+
"macgyer/yii2-materializecss": "^4.0"
42
45
},
43
46
```
44
47
@@ -65,6 +68,18 @@ public $depends = [
65
68
];
66
69
```
67
70
71
+
### Material Icons
72
+
73
+
To be compatible with GDPR (EU) the MaterializeFontAsset is not loaded automatically via the MaterializeAsset. The font asset requests the Material Icon font from Google servers (as stated in the Materialize docs).
74
+
75
+
If you are **not** affected by GDPR, simply load the MaterializeFontAsset in your layout or AppAsset.
76
+
77
+
Otherwise you need to self-host the Material Icon font (i. e. do not request them from Google). You could use ```material-icons``` (https://www.npmjs.com/package/material-icons) to load the font files, CSS and SCSS from NPM and include them in your build process.
78
+
79
+
### SCSS
80
+
81
+
Customizing Materialize via SCSS is easy. Integrate the Materialize SCSS in your own SCSS files and build your own version. Do not use the MaterializeAsset then as it loads the pre-built CSS provided by Materialize.
82
+
68
83
## Widgets
69
84
70
85
The following widgets are currently available:
@@ -137,6 +152,14 @@ You can find the sample layout file in ```src/layout/main.php```.
Copy file name to clipboardExpand all lines: src/widgets/Icon.php
+41-10Lines changed: 41 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,42 @@
15
15
/**
16
16
* Icon can be used to display a Materialize icon.
17
17
*
18
-
* Please note that the Materialize icons are shipped in a separate font file. This font file is automatically registered
19
-
* by the [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]].
18
+
* To be compatible with GDPR (EU) the MaterializeFontAsset is not loaded automatically via the [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]]. The font asset requests the Material Icon font from Google servers (as stated in the Materialize docs).
19
+
* If you are not affected by GDPR, simply load the [[\macgyer\yii2materializecss\assets\MaterializeFontAsset|MaterializeFontAsset]] in your layout or AppAsset.
20
20
*
21
-
* If you do not load the default [[\macgyer\yii2materializecss\assets\MaterializeAsset|MaterializeAsset]] make sure to at least load
22
-
* [[\macgyer\yii2materializecss\assets\MaterializeFontAsset|MaterializeFontAsset]] (or another source providing the font file) to correctly
23
-
* display the icons.
21
+
* Otherwise you need to self-host the Material Icon font (i. e. do not request them from Google). You could use `material-icons` (https://www.npmjs.com/package/material-icons) to load the font files, CSS and SCSS from NPM and include them in your build process.
24
22
*
25
23
* @author Christoph Erdmann <yii2-materializecss@pluspunkt-coding.de>
26
24
* @package widgets
27
25
* @see https://materializecss.com/icons.html
28
26
*/
29
27
class Icon extends BaseWidget
30
28
{
29
+
/**
30
+
* Sets the [[size]] of the icon to "tiny".
31
+
*/
32
+
publicconstSIZE_TINY = 'tiny';
33
+
/**
34
+
* Sets the [[size]] of the icon to "small". This is the default.
35
+
*/
36
+
publicconstSIZE_SMALL = 'small';
37
+
/**
38
+
* Sets the [[size]] of the icon to "medium".
39
+
*/
40
+
publicconstSIZE_MEDIUM = 'medium';
41
+
/**
42
+
* Sets the [[size]] of the icon to "large".
43
+
*/
44
+
publicconstSIZE_LARGE = 'large';
45
+
/**
46
+
* Sets the [[position]] of the icon to "left".
47
+
*/
48
+
publicconstPOSITION_LEFT = 'left';
49
+
/**
50
+
* Sets the [[position]] of the icon to "right".
51
+
*/
52
+
publicconstPOSITION_RIGHT = 'right';
53
+
31
54
/**
32
55
* @var string the name of the icon.
33
56
*
@@ -40,11 +63,16 @@ class Icon extends BaseWidget
40
63
*
41
64
* Currently "left" and "right" are natively supported by Materialize, but you can set this property to a custom string
42
65
* which will be added to the HTML class attribute and thus can be individually styled.
43
-
*
44
-
* The default icon position is "left".
45
66
*/
46
67
public$position;
47
68
69
+
/**
70
+
* @var string the size of the icon.
71
+
*
72
+
* The default icon size is "small".
73
+
*/
74
+
public$size = self::SIZE_SMALL;
75
+
48
76
/**
49
77
* @var array the HTML options for the icon tag.
50
78
*
@@ -69,12 +97,15 @@ public function init()
69
97
if (!$this->name) {
70
98
thrownewInvalidConfigException('The icon name must be specified.');
Copy file name to clipboardExpand all lines: src/widgets/Modal.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ class Modal extends BaseWidget
122
122
* - label: string, the label of the button. Defaults to '×'.
123
123
*
124
124
* The rest of the options will be rendered as the HTML attributes of the button tag.
125
-
* Please refer to the [Modal plugin help](http://materializecss.com/modals.html)
125
+
* Please refer to the [Modal plugin help](https://materializecss.github.io/materialize/modals.html)
126
126
* for the supported HTML attributes.
127
127
* @see [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
128
128
*/
@@ -155,7 +155,7 @@ class Modal extends BaseWidget
155
155
* - label: string, the label of the button. Defaults to 'Show'.
156
156
*
157
157
* The rest of the options will be rendered as the HTML attributes of the button tag.
158
-
* Please refer to the [Modal plugin help](http://materializecss.com/modals.html)
158
+
* Please refer to the [Modal plugin help](https://materializecss.github.io/materialize/modals.html)
159
159
* for the supported HTML attributes.
160
160
* @see [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
0 commit comments