mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Replacing deprecated ::className() with ::class (#18671)
This commit is contained in:
@ -29,7 +29,7 @@ Jeśli ten argument nie zostanie podany, kod JavaScript zostanie użyty jako ID.
|
||||
Skrypt zewnętrzny może zostać dodany następująco:
|
||||
|
||||
```php
|
||||
$this->registerJsFile('http://example.com/js/main.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
|
||||
$this->registerJsFile('http://example.com/js/main.js', ['depends' => [\yii\web\JqueryAsset::class]]);
|
||||
```
|
||||
|
||||
Argumenty dla metod [[yii\web\View::registerCssFile()|registerCssFile()]] są podobne do [[yii\web\View::registerJsFile()|registerJsFile()]].
|
||||
@ -73,7 +73,7 @@ Jeśli chcesz się upewnić, że jest tylko jeden tag `style`, użyj trzeciego a
|
||||
|
||||
```php
|
||||
$this->registerCssFile("http://example.com/css/themes/black-and-white.css", [
|
||||
'depends' => [BootstrapAsset::className()],
|
||||
'depends' => [BootstrapAsset::class],
|
||||
'media' => 'print',
|
||||
], 'css-print-theme');
|
||||
```
|
||||
@ -86,4 +86,4 @@ Kod powyżej doda link w sekcji `head` strony do pliku CSS.
|
||||
* Ostatni argument określa ID identyfikujące ten plik CSS. W przypadku jego braku, zostanie użyty do tego celu adres URL pliku CSS.
|
||||
|
||||
Jest mocno wskazane używanie [assetów](structure-assets.md) do rejestrowania zewnętrznych plików CSS. Użycie ich pozwala Ci na łączenie i kompresowanie
|
||||
wielu plików CSS, które jest wręcz niezbędne na stronach internetowych o dużym natężeniu ruchu.
|
||||
wielu plików CSS, które jest wręcz niezbędne na stronach internetowych o dużym natężeniu ruchu.
|
||||
|
||||
Reference in New Issue
Block a user