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