1 | <?php |
||
24 | class DataTypesModule extends ResourceLoaderModule { |
||
25 | |||
26 | /** |
||
27 | * @var DataType[] |
||
28 | */ |
||
29 | protected $dataTypes; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $dataTypesConfigVarName; |
||
35 | |||
36 | /** |
||
37 | * @var DataTypeFactory |
||
38 | */ |
||
39 | protected $dataTypeFactory; |
||
40 | |||
41 | /** |
||
42 | * @since 0.1 |
||
43 | * |
||
44 | * @param array $resourceDefinition |
||
45 | */ |
||
46 | public function __construct( array $resourceDefinition ) { |
||
56 | |||
57 | /** |
||
58 | * @since 0.1 |
||
59 | * |
||
60 | * @param array $resourceDefinition |
||
61 | * |
||
62 | * @return string |
||
63 | * @throws Exception If the given resource definition is not sufficient |
||
64 | */ |
||
65 | public static function extractDataTypesConfigVarNameFromResourceDefinition( |
||
81 | |||
82 | /** |
||
83 | * @since 0.1 |
||
84 | * |
||
85 | * @param array $resourceDefinition |
||
86 | * |
||
87 | * @return DataTypeFactory |
||
88 | * @throws Exception If the given resource definition is not sufficient |
||
89 | */ |
||
90 | public static function extractDataTypeFactoryFromResourceDefinition( |
||
110 | |||
111 | /** |
||
112 | * Returns the name of the config var key under which the data type definition will be available |
||
113 | * in JavaScript using "mw.config.get( '...' )" |
||
114 | * |
||
115 | * @since 0.1 |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getConfigVarName() { |
||
122 | |||
123 | /** |
||
124 | * Returns the data types factory providing the data type information. |
||
125 | * |
||
126 | * @since 0.1 |
||
127 | * |
||
128 | * @return DataTypeFactory |
||
129 | */ |
||
130 | public function getDataTypeFactory() { |
||
133 | |||
134 | /** |
||
135 | * Used to propagate available data type ids to JavaScript. |
||
136 | * Data type ids will be available in 'wbDataTypeIds' config var. |
||
137 | * @see ResourceLoaderModule::getScript |
||
138 | * |
||
139 | * @since 0.1 |
||
140 | * |
||
141 | * @param ResourceLoaderContext $context |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function getScript( ResourceLoaderContext $context ) { |
||
156 | |||
157 | /** |
||
158 | * Returns the message keys of the registered data types. |
||
159 | * @see ResourceLoaderModule::getMessages |
||
160 | * @since 0.1 |
||
161 | * |
||
162 | * @return string[] |
||
163 | */ |
||
164 | public function getMessages() { |
||
176 | |||
177 | /** |
||
178 | * @see ResourceLoaderModule::getDefinitionSummary |
||
179 | * |
||
180 | * @param ResourceLoaderContext $context |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | public function getDefinitionSummary( ResourceLoaderContext $context ) { |
||
193 | |||
194 | } |
||
195 |