| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class FlatpickrAsset extends AssetBundle |
||
| 17 | { |
||
| 18 | /** @var string */ |
||
| 19 | public $sourcePath = '@npm/flatpickr/dist'; |
||
| 20 | |||
| 21 | /** @var array */ |
||
| 22 | public $js = [ |
||
| 23 | 'flatpickr.min.js', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | /** @var array */ |
||
| 27 | public $css = [ |
||
| 28 | 'flatpickr.min.css', |
||
| 29 | ]; |
||
| 30 | |||
| 31 | /** @var string */ |
||
| 32 | public $theme; |
||
| 33 | |||
| 34 | /** @var string */ |
||
| 35 | public $locale; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @inheritdoc |
||
| 39 | */ |
||
| 40 | 3 | public function registerAssetFiles($view) |
|
| 41 | { |
||
| 42 | 3 | $this->registerLanguageFile(); |
|
| 43 | 3 | $this->registerThemeFile(); |
|
| 44 | |||
| 45 | 3 | parent::registerAssetFiles($view); |
|
| 46 | 3 | } |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Registers language file |
||
| 50 | */ |
||
| 51 | 3 | private function registerLanguageFile() |
|
| 52 | { |
||
| 53 | 3 | if (!empty($this->locale) && ($this->locale !== 'en')) { |
|
| 54 | 1 | $this->js[] = 'l10n/' . $this->locale . '.js'; |
|
| 55 | } |
||
| 56 | 3 | } |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Registers theme |
||
| 60 | */ |
||
| 61 | 3 | private function registerThemeFile() |
|
| 65 | } |
||
| 66 | 3 | } |
|
| 67 | } |
||
| 68 |