1 | <?php |
||
33 | class Formatter extends \yii\i18n\Formatter |
||
34 | { |
||
35 | /** |
||
36 | * @var array An array with date formats to use as default values where key is the local language and value the format |
||
37 | * to use for the given language. |
||
38 | * |
||
39 | * ```php |
||
40 | * 'dateFormats' => [ |
||
41 | * 'fr' => 'dd.MM.yyyy', |
||
42 | * 'en' => 'MM/dd/yyyy', |
||
43 | * ] |
||
44 | * ``` |
||
45 | * |
||
46 | * See {{\luya\component\Formatter::$dateFormat}} for more informations about valid values. |
||
47 | */ |
||
48 | public $dateFormats = []; |
||
49 | |||
50 | /** |
||
51 | * @var array An array with datetime formats to use as default values where the key is the local language and value |
||
52 | * the format to use for the given language. |
||
53 | * |
||
54 | * ```php |
||
55 | * 'datetimeFormats' => [ |
||
56 | * 'fr' => 'dd.MM.yyyy - HH:mm:ss', |
||
57 | * 'en' => 'MM/dd/yyyy HH:mm:ss', |
||
58 | * ] |
||
59 | * ``` |
||
60 | * |
||
61 | * See {{\luya\component\Formatter::$datetimeFormat}} for more informations about valid values. |
||
62 | */ |
||
63 | public $datetimeFormats = []; |
||
64 | |||
65 | /** |
||
66 | * @var array An array with time formats to use as default values where the key is the local language and value |
||
67 | * the format to use for the given language. |
||
68 | * |
||
69 | * ```php |
||
70 | * 'timeFormats' => [ |
||
71 | * 'fr' => 'HH:mm:ss', |
||
72 | * 'de' => 'HH.mm.ss', |
||
73 | * ], |
||
74 | * ``` |
||
75 | * |
||
76 | * See {{\luya\component\Formatter::$timeFormat}} for more informations about valid values. |
||
77 | */ |
||
78 | public $timeFormats = []; |
||
79 | |||
80 | /** |
||
81 | * @inheritdoc |
||
82 | */ |
||
83 | public function init() |
||
99 | |||
100 | /** |
||
101 | * Auto format the value to a given format like url, email. |
||
102 | * |
||
103 | * The following rules will apply to auto format the value: |
||
104 | * |
||
105 | * + boolean: asBool |
||
106 | * + email: asEmail |
||
107 | * + url: asUrl |
||
108 | * |
||
109 | * @param mixed $value Returns the formated value otherwise the original input value. |
||
110 | * @since 1.0.9 |
||
111 | */ |
||
112 | public function autoFormat($value) |
||
131 | } |
||
132 |