Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/OptionValue.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e0b7f9a8 | 9 | * (GenCodeChecksum:598cce8df447dc19cd4c846549be1141) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the OptionValue entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_OptionValue extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.5'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_option_value'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e0b7f9a8 CW |
33 | /** |
34 | * Paths for accessing this entity in the UI. | |
35 | * | |
36 | * @var string[] | |
37 | */ | |
38 | protected static $_paths = [ | |
39 | 'update' => 'civicrm/admin/options/[option_group_id:name]?reset=1&action=update&id=[id]', | |
40 | 'delete' => 'civicrm/admin/options/[option_group_id:name]?reset=1&action=delete&id=[id]', | |
41 | ]; | |
42 | ||
e501603b TO |
43 | /** |
44 | * Option ID | |
45 | * | |
e6ca0a57 | 46 | * @var int |
e501603b TO |
47 | */ |
48 | public $id; | |
c3fc2621 | 49 | |
e501603b TO |
50 | /** |
51 | * Group which this option belongs to. | |
52 | * | |
e6ca0a57 | 53 | * @var int |
e501603b TO |
54 | */ |
55 | public $option_group_id; | |
c3fc2621 | 56 | |
e501603b TO |
57 | /** |
58 | * Option string as displayed to users - e.g. the label in an HTML OPTION tag. | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $label; | |
c3fc2621 | 63 | |
e501603b TO |
64 | /** |
65 | * The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key. | |
66 | * | |
67 | * @var string | |
68 | */ | |
69 | public $value; | |
c3fc2621 | 70 | |
e501603b TO |
71 | /** |
72 | * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row. | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $name; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners. | |
80 | * | |
81 | * @var string | |
82 | */ | |
83 | public $grouping; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * Bitwise logic can be used to create subsets of options within an option_group for different uses. | |
87 | * | |
e6ca0a57 | 88 | * @var int |
e501603b TO |
89 | */ |
90 | public $filter; | |
c3fc2621 | 91 | |
e501603b TO |
92 | /** |
93 | * Is this the default option for the group? | |
94 | * | |
e6ca0a57 | 95 | * @var bool |
e501603b TO |
96 | */ |
97 | public $is_default; | |
c3fc2621 | 98 | |
e501603b TO |
99 | /** |
100 | * Controls display sort order. | |
101 | * | |
e6ca0a57 | 102 | * @var int |
e501603b TO |
103 | */ |
104 | public $weight; | |
c3fc2621 | 105 | |
e501603b TO |
106 | /** |
107 | * Optional description. | |
108 | * | |
109 | * @var text | |
110 | */ | |
111 | public $description; | |
c3fc2621 | 112 | |
e501603b TO |
113 | /** |
114 | * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options? | |
115 | * | |
e6ca0a57 | 116 | * @var bool |
e501603b TO |
117 | */ |
118 | public $is_optgroup; | |
c3fc2621 | 119 | |
e501603b TO |
120 | /** |
121 | * Is this a predefined system object? | |
122 | * | |
e6ca0a57 | 123 | * @var bool |
e501603b TO |
124 | */ |
125 | public $is_reserved; | |
c3fc2621 | 126 | |
e501603b TO |
127 | /** |
128 | * Is this option active? | |
129 | * | |
e6ca0a57 | 130 | * @var bool |
e501603b TO |
131 | */ |
132 | public $is_active; | |
c3fc2621 | 133 | |
e501603b TO |
134 | /** |
135 | * Component that this option value belongs/caters to. | |
136 | * | |
e6ca0a57 | 137 | * @var int |
e501603b TO |
138 | */ |
139 | public $component_id; | |
c3fc2621 | 140 | |
e501603b TO |
141 | /** |
142 | * Which Domain is this option value for | |
143 | * | |
e6ca0a57 | 144 | * @var int |
e501603b TO |
145 | */ |
146 | public $domain_id; | |
c3fc2621 | 147 | |
e501603b | 148 | /** |
e6ca0a57 | 149 | * @var int |
e501603b TO |
150 | */ |
151 | public $visibility_id; | |
c3fc2621 | 152 | |
b412f764 CW |
153 | /** |
154 | * crm-i icon class | |
155 | * | |
156 | * @var string | |
157 | */ | |
158 | public $icon; | |
c3fc2621 | 159 | |
d73974ac CW |
160 | /** |
161 | * Hex color value e.g. #ffffff | |
162 | * | |
163 | * @var string | |
164 | */ | |
165 | public $color; | |
c3fc2621 | 166 | |
e501603b | 167 | /** |
f41f0342 | 168 | * Class constructor. |
e501603b | 169 | */ |
c3fc2621 | 170 | public function __construct() { |
e501603b TO |
171 | $this->__table = 'civicrm_option_value'; |
172 | parent::__construct(); | |
173 | } | |
c3fc2621 | 174 | |
449c4e6b CW |
175 | /** |
176 | * Returns localized title of this entity. | |
7b66c3b5 AH |
177 | * |
178 | * @param bool $plural | |
179 | * Whether to return the plural version of the title. | |
449c4e6b | 180 | */ |
7b66c3b5 AH |
181 | public static function getEntityTitle($plural = FALSE) { |
182 | return $plural ? ts('Option Values') : ts('Option Value'); | |
449c4e6b CW |
183 | } |
184 | ||
e501603b | 185 | /** |
f41f0342 | 186 | * Returns foreign keys and entity references. |
e501603b TO |
187 | * |
188 | * @return array | |
189 | * [CRM_Core_Reference_Interface] | |
190 | */ | |
c3fc2621 | 191 | public static function getReferenceColumns() { |
346aaaba | 192 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 193 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
194 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id'); |
195 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); | |
196 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); | |
346aaaba | 197 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 198 | } |
346aaaba | 199 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 200 | } |
c3fc2621 | 201 | |
e501603b TO |
202 | /** |
203 | * Returns all the column names of this table | |
204 | * | |
205 | * @return array | |
206 | */ | |
c3fc2621 | 207 | public static function &fields() { |
346aaaba | 208 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
209 | Civi::$statics[__CLASS__]['fields'] = [ |
210 | 'id' => [ | |
e501603b TO |
211 | 'name' => 'id', |
212 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 213 | 'title' => ts('Option Value ID'), |
215b423e | 214 | 'description' => ts('Option ID'), |
c3fc2621 | 215 | 'required' => TRUE, |
a36434b9 | 216 | 'where' => 'civicrm_option_value.id', |
522a26c9 | 217 | 'table_name' => 'civicrm_option_value', |
218 | 'entity' => 'OptionValue', | |
219 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 220 | 'localizable' => 0, |
1fe423d6 | 221 | 'readonly' => TRUE, |
a9d0587b | 222 | 'add' => '1.5', |
c3fc2621 CW |
223 | ], |
224 | 'option_group_id' => [ | |
e501603b TO |
225 | 'name' => 'option_group_id', |
226 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 227 | 'title' => ts('Option Group ID'), |
215b423e | 228 | 'description' => ts('Group which this option belongs to.'), |
c3fc2621 | 229 | 'required' => TRUE, |
a36434b9 | 230 | 'where' => 'civicrm_option_value.option_group_id', |
522a26c9 | 231 | 'table_name' => 'civicrm_option_value', |
232 | 'entity' => 'OptionValue', | |
233 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 234 | 'localizable' => 0, |
e501603b | 235 | 'FKClassName' => 'CRM_Core_DAO_OptionGroup', |
c3fc2621 | 236 | 'html' => [ |
e501603b | 237 | 'type' => 'Select', |
2cbbebe8 | 238 | 'label' => ts("Option Group"), |
c3fc2621 CW |
239 | ], |
240 | 'pseudoconstant' => [ | |
e501603b TO |
241 | 'table' => 'civicrm_option_group', |
242 | 'keyColumn' => 'id', | |
17f78bae CW |
243 | 'labelColumn' => 'title', |
244 | 'nameColumn' => 'name', | |
e6ca0a57 | 245 | ], |
a9d0587b | 246 | 'add' => '1.5', |
c3fc2621 CW |
247 | ], |
248 | 'label' => [ | |
e501603b TO |
249 | 'name' => 'label', |
250 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 251 | 'title' => ts('Option Label'), |
215b423e | 252 | 'description' => ts('Option string as displayed to users - e.g. the label in an HTML OPTION tag.'), |
c3fc2621 | 253 | 'required' => TRUE, |
e501603b TO |
254 | 'maxlength' => 512, |
255 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 256 | 'where' => 'civicrm_option_value.label', |
522a26c9 | 257 | 'table_name' => 'civicrm_option_value', |
258 | 'entity' => 'OptionValue', | |
259 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 260 | 'localizable' => 1, |
a9d0587b | 261 | 'add' => '1.5', |
c3fc2621 CW |
262 | ], |
263 | 'value' => [ | |
e501603b TO |
264 | 'name' => 'value', |
265 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 266 | 'title' => ts('Option Value'), |
215b423e | 267 | 'description' => ts('The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.'), |
c3fc2621 | 268 | 'required' => TRUE, |
e501603b TO |
269 | 'maxlength' => 512, |
270 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 271 | 'where' => 'civicrm_option_value.value', |
522a26c9 | 272 | 'table_name' => 'civicrm_option_value', |
273 | 'entity' => 'OptionValue', | |
274 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 275 | 'localizable' => 0, |
a9d0587b | 276 | 'add' => '1.5', |
c3fc2621 CW |
277 | ], |
278 | 'name' => [ | |
e501603b TO |
279 | 'name' => 'name', |
280 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 281 | 'title' => ts('Option Name'), |
215b423e | 282 | 'description' => ts('Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.'), |
e501603b TO |
283 | 'maxlength' => 255, |
284 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 285 | 'import' => TRUE, |
e501603b | 286 | 'where' => 'civicrm_option_value.name', |
c3fc2621 | 287 | 'export' => TRUE, |
522a26c9 | 288 | 'table_name' => 'civicrm_option_value', |
289 | 'entity' => 'OptionValue', | |
290 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 291 | 'localizable' => 0, |
a9d0587b | 292 | 'add' => '1.5', |
c3fc2621 CW |
293 | ], |
294 | 'grouping' => [ | |
e501603b TO |
295 | 'name' => 'grouping', |
296 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 297 | 'title' => ts('Option Grouping Name'), |
215b423e | 298 | 'description' => ts('Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.'), |
e501603b TO |
299 | 'maxlength' => 255, |
300 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 301 | 'where' => 'civicrm_option_value.grouping', |
522a26c9 | 302 | 'table_name' => 'civicrm_option_value', |
303 | 'entity' => 'OptionValue', | |
304 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 305 | 'localizable' => 0, |
a9d0587b | 306 | 'add' => '1.5', |
c3fc2621 CW |
307 | ], |
308 | 'filter' => [ | |
e501603b TO |
309 | 'name' => 'filter', |
310 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 311 | 'title' => ts('Filter'), |
215b423e | 312 | 'description' => ts('Bitwise logic can be used to create subsets of options within an option_group for different uses.'), |
a36434b9 | 313 | 'where' => 'civicrm_option_value.filter', |
b8be3222 | 314 | 'default' => '0', |
522a26c9 | 315 | 'table_name' => 'civicrm_option_value', |
316 | 'entity' => 'OptionValue', | |
317 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 318 | 'localizable' => 0, |
c23563e3 SL |
319 | 'html' => [ |
320 | 'label' => ts("Filter"), | |
321 | ], | |
a9d0587b | 322 | 'add' => '1.5', |
c3fc2621 CW |
323 | ], |
324 | 'is_default' => [ | |
e501603b TO |
325 | 'name' => 'is_default', |
326 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 327 | 'title' => ts('Option is Default?'), |
215b423e | 328 | 'description' => ts('Is this the default option for the group?'), |
a36434b9 | 329 | 'where' => 'civicrm_option_value.is_default', |
45a83e42 | 330 | 'default' => '0', |
522a26c9 | 331 | 'table_name' => 'civicrm_option_value', |
332 | 'entity' => 'OptionValue', | |
333 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 334 | 'localizable' => 0, |
a9d0587b | 335 | 'add' => '1.5', |
c3fc2621 CW |
336 | ], |
337 | 'weight' => [ | |
e501603b TO |
338 | 'name' => 'weight', |
339 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 340 | 'title' => ts('Order'), |
215b423e | 341 | 'description' => ts('Controls display sort order.'), |
c3fc2621 | 342 | 'required' => TRUE, |
a36434b9 | 343 | 'where' => 'civicrm_option_value.weight', |
522a26c9 | 344 | 'table_name' => 'civicrm_option_value', |
345 | 'entity' => 'OptionValue', | |
346 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 347 | 'localizable' => 0, |
a9d0587b | 348 | 'add' => '1.5', |
c3fc2621 CW |
349 | ], |
350 | 'description' => [ | |
e501603b TO |
351 | 'name' => 'description', |
352 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 353 | 'title' => ts('Option Description'), |
215b423e | 354 | 'description' => ts('Optional description.'), |
e501603b TO |
355 | 'rows' => 8, |
356 | 'cols' => 60, | |
a36434b9 | 357 | 'where' => 'civicrm_option_value.description', |
522a26c9 | 358 | 'table_name' => 'civicrm_option_value', |
359 | 'entity' => 'OptionValue', | |
360 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 361 | 'localizable' => 1, |
c3fc2621 | 362 | 'html' => [ |
e501603b | 363 | 'type' => 'TextArea', |
c3fc2621 | 364 | ], |
a9d0587b | 365 | 'add' => '1.5', |
c3fc2621 CW |
366 | ], |
367 | 'is_optgroup' => [ | |
e501603b TO |
368 | 'name' => 'is_optgroup', |
369 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 370 | 'title' => ts('Option is Header?'), |
215b423e | 371 | 'description' => ts('Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?'), |
a36434b9 | 372 | 'where' => 'civicrm_option_value.is_optgroup', |
45a83e42 | 373 | 'default' => '0', |
522a26c9 | 374 | 'table_name' => 'civicrm_option_value', |
375 | 'entity' => 'OptionValue', | |
376 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 377 | 'localizable' => 0, |
a9d0587b | 378 | 'add' => '1.5', |
c3fc2621 CW |
379 | ], |
380 | 'is_reserved' => [ | |
e501603b TO |
381 | 'name' => 'is_reserved', |
382 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 383 | 'title' => ts('Option Is Reserved?'), |
215b423e | 384 | 'description' => ts('Is this a predefined system object?'), |
a36434b9 | 385 | 'where' => 'civicrm_option_value.is_reserved', |
45a83e42 | 386 | 'default' => '0', |
522a26c9 | 387 | 'table_name' => 'civicrm_option_value', |
388 | 'entity' => 'OptionValue', | |
389 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 390 | 'localizable' => 0, |
a9d0587b | 391 | 'add' => '1.5', |
c3fc2621 CW |
392 | ], |
393 | 'is_active' => [ | |
e501603b TO |
394 | 'name' => 'is_active', |
395 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 396 | 'title' => ts('Option Is Active'), |
215b423e | 397 | 'description' => ts('Is this option active?'), |
a36434b9 | 398 | 'where' => 'civicrm_option_value.is_active', |
e501603b | 399 | 'default' => '1', |
522a26c9 | 400 | 'table_name' => 'civicrm_option_value', |
401 | 'entity' => 'OptionValue', | |
402 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 403 | 'localizable' => 0, |
a9d0587b | 404 | 'add' => '1.5', |
c3fc2621 CW |
405 | ], |
406 | 'component_id' => [ | |
e501603b TO |
407 | 'name' => 'component_id', |
408 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 409 | 'title' => ts('Component ID'), |
215b423e | 410 | 'description' => ts('Component that this option value belongs/caters to.'), |
a36434b9 | 411 | 'where' => 'civicrm_option_value.component_id', |
522a26c9 | 412 | 'table_name' => 'civicrm_option_value', |
413 | 'entity' => 'OptionValue', | |
414 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 415 | 'localizable' => 0, |
e501603b | 416 | 'FKClassName' => 'CRM_Core_DAO_Component', |
c3fc2621 | 417 | 'html' => [ |
e501603b | 418 | 'type' => 'Select', |
2cbbebe8 | 419 | 'label' => ts("Component"), |
c3fc2621 CW |
420 | ], |
421 | 'pseudoconstant' => [ | |
e501603b TO |
422 | 'table' => 'civicrm_component', |
423 | 'keyColumn' => 'id', | |
424 | 'labelColumn' => 'name', | |
e6ca0a57 | 425 | ], |
a9d0587b | 426 | 'add' => '2.0', |
c3fc2621 CW |
427 | ], |
428 | 'domain_id' => [ | |
e501603b TO |
429 | 'name' => 'domain_id', |
430 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 431 | 'title' => ts('Domain ID'), |
215b423e | 432 | 'description' => ts('Which Domain is this option value for'), |
a36434b9 | 433 | 'where' => 'civicrm_option_value.domain_id', |
522a26c9 | 434 | 'table_name' => 'civicrm_option_value', |
435 | 'entity' => 'OptionValue', | |
436 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 437 | 'localizable' => 0, |
e501603b | 438 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
439 | 'html' => [ |
440 | 'label' => ts("Domain"), | |
441 | ], | |
c3fc2621 | 442 | 'pseudoconstant' => [ |
e501603b TO |
443 | 'table' => 'civicrm_domain', |
444 | 'keyColumn' => 'id', | |
445 | 'labelColumn' => 'name', | |
e6ca0a57 | 446 | ], |
a9d0587b | 447 | 'add' => '3.1', |
c3fc2621 CW |
448 | ], |
449 | 'visibility_id' => [ | |
e501603b TO |
450 | 'name' => 'visibility_id', |
451 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 452 | 'title' => ts('Option Visibility'), |
a36434b9 | 453 | 'where' => 'civicrm_option_value.visibility_id', |
5fb0de1f | 454 | 'default' => NULL, |
522a26c9 | 455 | 'table_name' => 'civicrm_option_value', |
456 | 'entity' => 'OptionValue', | |
457 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 458 | 'localizable' => 0, |
e78e618d PN |
459 | 'pseudoconstant' => [ |
460 | 'optionGroupName' => 'visibility', | |
461 | 'optionEditPath' => 'civicrm/admin/options/visibility', | |
e6ca0a57 | 462 | ], |
a9d0587b | 463 | 'add' => '2.2', |
c3fc2621 CW |
464 | ], |
465 | 'icon' => [ | |
b412f764 CW |
466 | 'name' => 'icon', |
467 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 468 | 'title' => ts('Icon'), |
215b423e | 469 | 'description' => ts('crm-i icon class'), |
b412f764 CW |
470 | 'maxlength' => 255, |
471 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 472 | 'where' => 'civicrm_option_value.icon', |
5fb0de1f | 473 | 'default' => NULL, |
522a26c9 | 474 | 'table_name' => 'civicrm_option_value', |
475 | 'entity' => 'OptionValue', | |
476 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 477 | 'localizable' => 0, |
a9d0587b | 478 | 'add' => '4.7', |
c3fc2621 CW |
479 | ], |
480 | 'color' => [ | |
d73974ac CW |
481 | 'name' => 'color', |
482 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 483 | 'title' => ts('Color'), |
215b423e | 484 | 'description' => ts('Hex color value e.g. #ffffff'), |
d73974ac CW |
485 | 'maxlength' => 255, |
486 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 487 | 'where' => 'civicrm_option_value.color', |
5fb0de1f | 488 | 'default' => NULL, |
522a26c9 | 489 | 'table_name' => 'civicrm_option_value', |
490 | 'entity' => 'OptionValue', | |
491 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 492 | 'localizable' => 0, |
a9d0587b | 493 | 'add' => '4.7', |
c3fc2621 CW |
494 | ], |
495 | ]; | |
346aaaba | 496 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 497 | } |
346aaaba | 498 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 499 | } |
c3fc2621 | 500 | |
e501603b | 501 | /** |
bd8e0b14 | 502 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
503 | * |
504 | * @return array | |
bd8e0b14 | 505 | * Array(string $name => string $uniqueName). |
e501603b | 506 | */ |
c3fc2621 | 507 | public static function &fieldKeys() { |
bd8e0b14 TO |
508 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
509 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 510 | } |
bd8e0b14 | 511 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 512 | } |
c3fc2621 | 513 | |
e501603b TO |
514 | /** |
515 | * Returns the names of this table | |
516 | * | |
517 | * @return string | |
518 | */ | |
c3fc2621 | 519 | public static function getTableName() { |
e501603b TO |
520 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
521 | } | |
c3fc2621 | 522 | |
e501603b TO |
523 | /** |
524 | * Returns if this table needs to be logged | |
525 | * | |
c3fc2621 | 526 | * @return bool |
e501603b | 527 | */ |
c3fc2621 | 528 | public function getLog() { |
e501603b TO |
529 | return self::$_log; |
530 | } | |
c3fc2621 | 531 | |
e501603b TO |
532 | /** |
533 | * Returns the list of fields that can be imported | |
534 | * | |
535 | * @param bool $prefix | |
536 | * | |
537 | * @return array | |
538 | */ | |
c3fc2621 CW |
539 | public static function &import($prefix = FALSE) { |
540 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 541 | return $r; |
e501603b | 542 | } |
c3fc2621 | 543 | |
e501603b TO |
544 | /** |
545 | * Returns the list of fields that can be exported | |
546 | * | |
547 | * @param bool $prefix | |
548 | * | |
549 | * @return array | |
550 | */ | |
c3fc2621 CW |
551 | public static function &export($prefix = FALSE) { |
552 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 553 | return $r; |
e501603b | 554 | } |
c3fc2621 | 555 | |
e7a6b91a AS |
556 | /** |
557 | * Returns the list of indices | |
c3fc2621 CW |
558 | * |
559 | * @param bool $localize | |
560 | * | |
561 | * @return array | |
e7a6b91a AS |
562 | */ |
563 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
564 | $indices = [ |
565 | 'index_option_group_id_value' => [ | |
e7a6b91a | 566 | 'name' => 'index_option_group_id_value', |
c3fc2621 | 567 | 'field' => [ |
e7a6b91a AS |
568 | 0 => 'value(128)', |
569 | 1 => 'option_group_id', | |
c3fc2621 CW |
570 | ], |
571 | 'localizable' => FALSE, | |
e7a6b91a | 572 | 'sig' => 'civicrm_option_value::0::value(128)::option_group_id', |
c3fc2621 CW |
573 | ], |
574 | 'index_option_group_id_name' => [ | |
e7a6b91a | 575 | 'name' => 'index_option_group_id_name', |
c3fc2621 | 576 | 'field' => [ |
e7a6b91a AS |
577 | 0 => 'name(128)', |
578 | 1 => 'option_group_id', | |
c3fc2621 CW |
579 | ], |
580 | 'localizable' => FALSE, | |
e7a6b91a | 581 | 'sig' => 'civicrm_option_value::0::name(128)::option_group_id', |
c3fc2621 CW |
582 | ], |
583 | ]; | |
e7a6b91a AS |
584 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
585 | } | |
c3fc2621 | 586 | |
e501603b | 587 | } |