Merge remote-tracking branch 'upstream/4.4' into 4.4-4.5-2014-10-14-11-16-10
[civicrm-core.git] / api / v3 / examples / Contact / GetFieldsOptions.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using contact GetFields API
4 * Demonstrate retrieving metadata with custom field options *
6a488035
TO
5 */
6function contact_getfields_example(){
7a7cc10b 7$params = array(
8 'options' => array(
6a488035
TO
9 'get_options' => 'custom_1',
10 ),
6a488035
TO
11 'action' => 'create',
12);
13
fb32de45 14try{
15 $result = civicrm_api3('contact', 'GetFields', $params);
16}
17catch (CiviCRM_API3_Exception $e) {
18 // handle error here
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
23}
6a488035 24
fb32de45 25return $result;
6a488035
TO
26}
27
fb32de45 28/**
6a488035
TO
29 * Function returns array of result expected from previous function
30 */
31function contact_getfields_expectedresult(){
32
7a7cc10b 33 $expectedResult = array(
6a488035
TO
34 'is_error' => 0,
35 'version' => 3,
89bf81b4 36 'count' => 55,
7a7cc10b 37 'values' => array(
38 'id' => array(
6a488035
TO
39 'name' => 'id',
40 'type' => 1,
41 'title' => 'Internal Contact ID',
42 'required' => true,
43 'import' => true,
44 'where' => 'civicrm_contact.id',
45 'headerPattern' => '/internal|contact?|id$/i',
46 'export' => true,
7a7cc10b 47 'api.aliases' => array(
6a488035
TO
48 '0' => 'contact_id',
49 ),
50 ),
7a7cc10b 51 'contact_type' => array(
6a488035
TO
52 'name' => 'contact_type',
53 'type' => 2,
54 'title' => 'Contact Type',
55 'maxlength' => 64,
56 'size' => 30,
57 'export' => true,
58 'where' => 'civicrm_contact.contact_type',
89bf81b4 59 'html' => array(
60 'type' => 'Select',
61 ),
7a7cc10b 62 'pseudoconstant' => array(
63 'table' => 'civicrm_contact_type',
6a488035
TO
64 'keyColumn' => 'name',
65 'labelColumn' => 'label',
7a7cc10b 66 'condition' => 'parent_id IS NULL',
6a488035
TO
67 ),
68 'api.required' => 1,
6a488035 69 ),
7a7cc10b 70 'contact_sub_type' => array(
6a488035
TO
71 'name' => 'contact_sub_type',
72 'type' => 2,
73 'title' => 'Contact Subtype',
74 'maxlength' => 255,
75 'size' => 45,
76 'import' => true,
77 'where' => 'civicrm_contact.contact_sub_type',
78 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
79 'export' => true,
89bf81b4 80 'html' => array(
81 'type' => 'Multi-Select',
82 ),
7a7cc10b 83 'pseudoconstant' => array(
84 'table' => 'civicrm_contact_type',
85 'keyColumn' => 'name',
86 'labelColumn' => 'label',
87 'condition' => 'parent_id IS NOT NULL',
88 ),
6a488035 89 ),
7a7cc10b 90 'do_not_email' => array(
6a488035
TO
91 'name' => 'do_not_email',
92 'type' => 16,
93 'title' => 'Do Not Email',
94 'import' => true,
95 'where' => 'civicrm_contact.do_not_email',
96 'headerPattern' => '/d(o )?(not )?(email)/i',
b259a4ab 97 'dataPattern' => '/^\\d{1,}$/',
6a488035 98 'export' => true,
89bf81b4 99 'html' => array(
100 'type' => 'CheckBox',
101 ),
6a488035 102 ),
7a7cc10b 103 'do_not_phone' => array(
6a488035
TO
104 'name' => 'do_not_phone',
105 'type' => 16,
106 'title' => 'Do Not Phone',
107 'import' => true,
108 'where' => 'civicrm_contact.do_not_phone',
109 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
b259a4ab 110 'dataPattern' => '/^\\d{1,}$/',
6a488035 111 'export' => true,
89bf81b4 112 'html' => array(
113 'type' => 'CheckBox',
114 ),
6a488035 115 ),
7a7cc10b 116 'do_not_mail' => array(
6a488035
TO
117 'name' => 'do_not_mail',
118 'type' => 16,
119 'title' => 'Do Not Mail',
120 'import' => true,
121 'where' => 'civicrm_contact.do_not_mail',
b259a4ab
EM
122 'headerPattern' => '/^(d(o\\s)?n(ot\\s)?mail)|(\\w*)?bulk\\s?(\\w*)$/i',
123 'dataPattern' => '/^\\d{1,}$/',
6a488035 124 'export' => true,
89bf81b4 125 'html' => array(
126 'type' => 'CheckBox',
127 ),
6a488035 128 ),
7a7cc10b 129 'do_not_sms' => array(
6a488035
TO
130 'name' => 'do_not_sms',
131 'type' => 16,
132 'title' => 'Do Not Sms',
133 'import' => true,
134 'where' => 'civicrm_contact.do_not_sms',
135 'headerPattern' => '/d(o )?(not )?(sms)/i',
b259a4ab 136 'dataPattern' => '/^\\d{1,}$/',
6a488035 137 'export' => true,
89bf81b4 138 'html' => array(
139 'type' => 'CheckBox',
140 ),
6a488035 141 ),
7a7cc10b 142 'do_not_trade' => array(
6a488035
TO
143 'name' => 'do_not_trade',
144 'type' => 16,
145 'title' => 'Do Not Trade',
146 'import' => true,
147 'where' => 'civicrm_contact.do_not_trade',
148 'headerPattern' => '/d(o )?(not )?(trade)/i',
b259a4ab 149 'dataPattern' => '/^\\d{1,}$/',
6a488035 150 'export' => true,
89bf81b4 151 'html' => array(
152 'type' => 'CheckBox',
153 ),
6a488035 154 ),
7a7cc10b 155 'is_opt_out' => array(
6a488035
TO
156 'name' => 'is_opt_out',
157 'type' => 16,
158 'title' => 'No Bulk Emails (User Opt Out)',
159 'required' => true,
160 'import' => true,
161 'where' => 'civicrm_contact.is_opt_out',
162 'export' => true,
89bf81b4 163 'html' => array(
164 'type' => 'CheckBox',
165 ),
6a488035 166 ),
7a7cc10b 167 'legal_identifier' => array(
6a488035
TO
168 'name' => 'legal_identifier',
169 'type' => 2,
170 'title' => 'Legal Identifier',
171 'maxlength' => 32,
172 'size' => 20,
173 'import' => true,
174 'where' => 'civicrm_contact.legal_identifier',
b259a4ab
EM
175 'headerPattern' => '/legal\\s?id/i',
176 'dataPattern' => '/\\w+?\\d{5,}/',
6a488035 177 'export' => true,
89bf81b4 178 'html' => array(
179 'type' => 'Text',
180 ),
6a488035 181 ),
7a7cc10b 182 'external_identifier' => array(
6a488035
TO
183 'name' => 'external_identifier',
184 'type' => 2,
185 'title' => 'External Identifier',
186 'maxlength' => 32,
187 'size' => 8,
188 'import' => true,
189 'where' => 'civicrm_contact.external_identifier',
b259a4ab
EM
190 'headerPattern' => '/external\\s?id/i',
191 'dataPattern' => '/^\\d{11,}$/',
6a488035 192 'export' => true,
89bf81b4 193 'html' => array(
194 'type' => 'Text',
195 ),
6a488035 196 ),
7a7cc10b 197 'sort_name' => array(
6a488035
TO
198 'name' => 'sort_name',
199 'type' => 2,
200 'title' => 'Sort Name',
201 'maxlength' => 128,
202 'size' => 30,
203 'export' => true,
204 'where' => 'civicrm_contact.sort_name',
89bf81b4 205 'html' => array(
206 'type' => 'Text',
207 ),
6a488035 208 ),
7a7cc10b 209 'display_name' => array(
6a488035
TO
210 'name' => 'display_name',
211 'type' => 2,
212 'title' => 'Display Name',
213 'maxlength' => 128,
214 'size' => 30,
215 'export' => true,
216 'where' => 'civicrm_contact.display_name',
89bf81b4 217 'html' => array(
218 'type' => 'Text',
219 ),
6a488035 220 ),
7a7cc10b 221 'nick_name' => array(
6a488035
TO
222 'name' => 'nick_name',
223 'type' => 2,
7a7cc10b 224 'title' => 'Nickname',
6a488035
TO
225 'maxlength' => 128,
226 'size' => 30,
227 'import' => true,
228 'where' => 'civicrm_contact.nick_name',
b259a4ab
EM
229 'headerPattern' => '/n(ick\\s)name|nick$/i',
230 'dataPattern' => '/^\\w+$/',
6a488035 231 'export' => true,
89bf81b4 232 'html' => array(
233 'type' => 'Text',
234 ),
6a488035 235 ),
7a7cc10b 236 'legal_name' => array(
6a488035
TO
237 'name' => 'legal_name',
238 'type' => 2,
239 'title' => 'Legal Name',
240 'maxlength' => 128,
241 'size' => 30,
242 'import' => true,
243 'where' => 'civicrm_contact.legal_name',
b259a4ab 244 'headerPattern' => '/^legal|(l(egal\\s)?name)$/i',
6a488035 245 'export' => true,
89bf81b4 246 'html' => array(
247 'type' => 'Text',
248 ),
6a488035 249 ),
7a7cc10b 250 'image_URL' => array(
6a488035
TO
251 'name' => 'image_URL',
252 'type' => 2,
253 'title' => 'Image Url',
254 'maxlength' => 255,
255 'size' => 45,
256 'import' => true,
257 'where' => 'civicrm_contact.image_URL',
258 'export' => true,
89bf81b4 259 'html' => array(
260 'type' => 'Text',
261 ),
6a488035 262 ),
7a7cc10b 263 'preferred_communication_method' => array(
6a488035
TO
264 'name' => 'preferred_communication_method',
265 'type' => 2,
266 'title' => 'Preferred Communication Method',
267 'maxlength' => 255,
268 'size' => 45,
269 'import' => true,
270 'where' => 'civicrm_contact.preferred_communication_method',
b259a4ab
EM
271 'headerPattern' => '/^p(ref\\w*\\s)?c(omm\\w*)|( meth\\w*)$/i',
272 'dataPattern' => '/^\\w+$/',
6a488035 273 'export' => true,
89bf81b4 274 'html' => array(
275 'type' => 'Select',
276 ),
7a7cc10b 277 'pseudoconstant' => array(
278 'optionGroupName' => 'preferred_communication_method',
279 ),
6a488035 280 ),
7a7cc10b 281 'preferred_language' => array(
6a488035
TO
282 'name' => 'preferred_language',
283 'type' => 2,
284 'title' => 'Preferred Language',
285 'maxlength' => 5,
286 'size' => 6,
287 'import' => true,
288 'where' => 'civicrm_contact.preferred_language',
289 'headerPattern' => '/^lang/i',
290 'export' => true,
89bf81b4 291 'html' => array(
292 'type' => 'Select',
293 ),
7a7cc10b 294 'pseudoconstant' => array(
295 'optionGroupName' => 'languages',
296 'keyColumn' => 'name',
297 ),
6a488035 298 ),
7a7cc10b 299 'preferred_mail_format' => array(
6a488035
TO
300 'name' => 'preferred_mail_format',
301 'type' => 2,
302 'title' => 'Preferred Mail Format',
89bf81b4 303 'maxlength' => 8,
304 'size' => 8,
6a488035
TO
305 'import' => true,
306 'where' => 'civicrm_contact.preferred_mail_format',
b259a4ab 307 'headerPattern' => '/^p(ref\\w*\\s)?m(ail\\s)?f(orm\\w*)$/i',
6a488035
TO
308 'export' => true,
309 'default' => 'Both',
89bf81b4 310 'html' => array(
311 'type' => 'Select',
312 ),
313 'pseudoconstant' => array(
314 'callback' => 'CRM_Core_SelectValues::pmf',
315 ),
6a488035 316 ),
7a7cc10b 317 'hash' => array(
6a488035
TO
318 'name' => 'hash',
319 'type' => 2,
320 'title' => 'Contact Hash',
321 'maxlength' => 32,
322 'size' => 20,
323 'export' => true,
324 'where' => 'civicrm_contact.hash',
325 ),
7a7cc10b 326 'api_key' => array(
6a488035
TO
327 'name' => 'api_key',
328 'type' => 2,
329 'title' => 'Api Key',
330 'maxlength' => 32,
331 'size' => 20,
332 ),
7a7cc10b 333 'first_name' => array(
6a488035
TO
334 'name' => 'first_name',
335 'type' => 2,
336 'title' => 'First Name',
337 'maxlength' => 64,
338 'size' => 30,
339 'import' => true,
340 'where' => 'civicrm_contact.first_name',
b259a4ab
EM
341 'headerPattern' => '/^first|(f(irst\\s)?name)$/i',
342 'dataPattern' => '/^\\w+$/',
6a488035 343 'export' => true,
89bf81b4 344 'html' => array(
345 'type' => 'Text',
346 ),
6a488035 347 ),
7a7cc10b 348 'middle_name' => array(
6a488035
TO
349 'name' => 'middle_name',
350 'type' => 2,
351 'title' => 'Middle Name',
352 'maxlength' => 64,
353 'size' => 20,
354 'import' => true,
355 'where' => 'civicrm_contact.middle_name',
b259a4ab
EM
356 'headerPattern' => '/^middle|(m(iddle\\s)?name)$/i',
357 'dataPattern' => '/^\\w+$/',
6a488035 358 'export' => true,
89bf81b4 359 'html' => array(
360 'type' => 'Text',
361 ),
6a488035 362 ),
7a7cc10b 363 'last_name' => array(
6a488035
TO
364 'name' => 'last_name',
365 'type' => 2,
366 'title' => 'Last Name',
367 'maxlength' => 64,
368 'size' => 30,
369 'import' => true,
370 'where' => 'civicrm_contact.last_name',
b259a4ab
EM
371 'headerPattern' => '/^last|(l(ast\\s)?name)$/i',
372 'dataPattern' => '/^\\w+(\\s\\w+)?+$/',
6a488035 373 'export' => true,
89bf81b4 374 'html' => array(
375 'type' => 'Text',
376 ),
6a488035 377 ),
9f1b81e0 378 'prefix_id' => array(
379 'name' => 'prefix_id',
380 'type' => 1,
381 'title' => 'Individual Prefix',
382 'import' => true,
383 'where' => 'civicrm_contact.prefix_id',
384 'headerPattern' => '/^(prefix|title)/i',
b259a4ab 385 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\\.?$/i',
9f1b81e0 386 'export' => true,
89bf81b4 387 'html' => array(
388 'type' => 'Select',
389 ),
9f1b81e0 390 'pseudoconstant' => array(
391 'optionGroupName' => 'individual_prefix',
392 ),
b422b715 393 'api.aliases' => array(
394 '0' => 'individual_prefix',
395 '1' => 'individual_prefix_id',
396 ),
9f1b81e0 397 ),
398 'suffix_id' => array(
399 'name' => 'suffix_id',
400 'type' => 1,
401 'title' => 'Individual Suffix',
402 'import' => true,
403 'where' => 'civicrm_contact.suffix_id',
404 'headerPattern' => '/^suffix$/i',
b259a4ab 405 'dataPattern' => '/^(sr|jr)\\.?|i{2,}$/',
9f1b81e0 406 'export' => true,
89bf81b4 407 'html' => array(
408 'type' => 'Select',
409 ),
9f1b81e0 410 'pseudoconstant' => array(
411 'optionGroupName' => 'individual_suffix',
412 ),
b422b715 413 'api.aliases' => array(
414 '0' => 'individual_suffix',
415 '1' => 'individual_suffix_id',
416 ),
9f1b81e0 417 ),
89bf81b4 418 'formal_title' => array(
419 'name' => 'formal_title',
420 'type' => 2,
421 'title' => 'Formal Title',
422 'maxlength' => 64,
423 'size' => 30,
424 'import' => true,
425 'where' => 'civicrm_contact.formal_title',
426 'headerPattern' => '/^title/i',
427 'export' => true,
428 ),
429 'communication_style_id' => array(
430 'name' => 'communication_style_id',
431 'type' => 1,
432 'title' => 'Communication Style',
433 'export' => true,
434 'where' => 'civicrm_contact.communication_style_id',
435 'pseudoconstant' => array(
436 'optionGroupName' => 'communication_style',
437 ),
438 ),
7a7cc10b 439 'email_greeting_id' => array(
6a488035
TO
440 'name' => 'email_greeting_id',
441 'type' => 1,
442 'title' => 'Email Greeting ID',
443 ),
7a7cc10b 444 'email_greeting_custom' => array(
6a488035
TO
445 'name' => 'email_greeting_custom',
446 'type' => 2,
447 'title' => 'Email Greeting Custom',
448 'maxlength' => 128,
449 'size' => 45,
450 'import' => true,
451 'where' => 'civicrm_contact.email_greeting_custom',
89bf81b4 452 'html' => array(
453 'type' => 'Text',
454 ),
6a488035 455 ),
7a7cc10b 456 'email_greeting_display' => array(
6a488035
TO
457 'name' => 'email_greeting_display',
458 'type' => 2,
459 'title' => 'Email Greeting',
460 'maxlength' => 255,
461 'size' => 45,
89bf81b4 462 'html' => array(
463 'type' => 'Text',
464 ),
6a488035 465 ),
7a7cc10b 466 'postal_greeting_id' => array(
6a488035
TO
467 'name' => 'postal_greeting_id',
468 'type' => 1,
469 'title' => 'Postal Greeting ID',
89bf81b4 470 'html' => array(
471 'type' => 'Text',
472 ),
6a488035 473 ),
7a7cc10b 474 'postal_greeting_custom' => array(
6a488035
TO
475 'name' => 'postal_greeting_custom',
476 'type' => 2,
477 'title' => 'Postal Greeting Custom',
478 'maxlength' => 128,
479 'size' => 45,
480 'import' => true,
481 'where' => 'civicrm_contact.postal_greeting_custom',
89bf81b4 482 'html' => array(
483 'type' => 'Text',
484 ),
6a488035 485 ),
7a7cc10b 486 'postal_greeting_display' => array(
6a488035
TO
487 'name' => 'postal_greeting_display',
488 'type' => 2,
489 'title' => 'Postal Greeting',
490 'maxlength' => 255,
491 'size' => 45,
89bf81b4 492 'html' => array(
493 'type' => 'Text',
494 ),
6a488035 495 ),
7a7cc10b 496 'addressee_id' => array(
6a488035
TO
497 'name' => 'addressee_id',
498 'type' => 1,
499 'title' => 'Addressee ID',
500 ),
7a7cc10b 501 'addressee_custom' => array(
6a488035
TO
502 'name' => 'addressee_custom',
503 'type' => 2,
504 'title' => 'Addressee Custom',
505 'maxlength' => 128,
506 'size' => 45,
507 'import' => true,
508 'where' => 'civicrm_contact.addressee_custom',
89bf81b4 509 'html' => array(
510 'type' => 'Text',
511 ),
6a488035 512 ),
7a7cc10b 513 'addressee_display' => array(
6a488035
TO
514 'name' => 'addressee_display',
515 'type' => 2,
516 'title' => 'Addressee',
517 'maxlength' => 255,
518 'size' => 45,
89bf81b4 519 'html' => array(
520 'type' => 'Text',
521 ),
6a488035 522 ),
7a7cc10b 523 'job_title' => array(
6a488035
TO
524 'name' => 'job_title',
525 'type' => 2,
526 'title' => 'Job Title',
527 'maxlength' => 255,
528 'size' => 20,
529 'import' => true,
530 'where' => 'civicrm_contact.job_title',
b259a4ab 531 'headerPattern' => '/^job|(j(ob\\s)?title)$/i',
6a488035
TO
532 'dataPattern' => '//',
533 'export' => true,
89bf81b4 534 'html' => array(
535 'type' => 'Text',
536 ),
6a488035 537 ),
7a7cc10b 538 'gender_id' => array(
6a488035
TO
539 'name' => 'gender_id',
540 'type' => 1,
541 'title' => 'Gender',
7a7cc10b 542 'import' => true,
543 'where' => 'civicrm_contact.gender_id',
544 'headerPattern' => '/^gender$/i',
545 'export' => true,
89bf81b4 546 'html' => array(
547 'type' => 'Select',
548 ),
7a7cc10b 549 'pseudoconstant' => array(
6a488035
TO
550 'optionGroupName' => 'gender',
551 ),
6a488035 552 ),
7a7cc10b 553 'birth_date' => array(
6a488035
TO
554 'name' => 'birth_date',
555 'type' => 4,
556 'title' => 'Birth Date',
557 'import' => true,
558 'where' => 'civicrm_contact.birth_date',
b259a4ab
EM
559 'headerPattern' => '/^birth|(b(irth\\s)?date)|D(\\W*)O(\\W*)B(\\W*)$/i',
560 'dataPattern' => '/\\d{4}-?\\d{2}-?\\d{2}/',
6a488035 561 'export' => true,
89bf81b4 562 'html' => array(
563 'type' => 'Select Date',
564 ),
6a488035 565 ),
7a7cc10b 566 'is_deceased' => array(
6a488035
TO
567 'name' => 'is_deceased',
568 'type' => 16,
569 'title' => 'Is Deceased',
570 'import' => true,
571 'where' => 'civicrm_contact.is_deceased',
b259a4ab 572 'headerPattern' => '/i(s\\s)?d(eceased)$/i',
6a488035 573 'export' => true,
89bf81b4 574 'html' => array(
575 'type' => 'CheckBox',
576 ),
6a488035 577 ),
7a7cc10b 578 'deceased_date' => array(
6a488035
TO
579 'name' => 'deceased_date',
580 'type' => 4,
581 'title' => 'Deceased Date',
582 'import' => true,
583 'where' => 'civicrm_contact.deceased_date',
b259a4ab 584 'headerPattern' => '/^deceased|(d(eceased\\s)?date)$/i',
6a488035 585 'export' => true,
89bf81b4 586 'html' => array(
587 'type' => 'Select Date',
588 ),
6a488035 589 ),
7a7cc10b 590 'household_name' => array(
6a488035
TO
591 'name' => 'household_name',
592 'type' => 2,
593 'title' => 'Household Name',
594 'maxlength' => 128,
595 'size' => 30,
596 'import' => true,
597 'where' => 'civicrm_contact.household_name',
b259a4ab
EM
598 'headerPattern' => '/^household|(h(ousehold\\s)?name)$/i',
599 'dataPattern' => '/^\\w+$/',
6a488035 600 'export' => true,
89bf81b4 601 'html' => array(
602 'type' => 'Text',
603 ),
6a488035 604 ),
7a7cc10b 605 'primary_contact_id' => array(
6a488035
TO
606 'name' => 'primary_contact_id',
607 'type' => 1,
608 'title' => 'Household Primary Contact ID',
609 'FKClassName' => 'CRM_Contact_DAO_Contact',
89bf81b4 610 'html' => array(
611 'type' => 'Select',
612 ),
6a488035 613 ),
7a7cc10b 614 'organization_name' => array(
6a488035
TO
615 'name' => 'organization_name',
616 'type' => 2,
617 'title' => 'Organization Name',
618 'maxlength' => 128,
619 'size' => 30,
620 'import' => true,
621 'where' => 'civicrm_contact.organization_name',
b259a4ab
EM
622 'headerPattern' => '/^organization|(o(rganization\\s)?name)$/i',
623 'dataPattern' => '/^\\w+$/',
6a488035 624 'export' => true,
89bf81b4 625 'html' => array(
626 'type' => 'Text',
627 ),
6a488035 628 ),
7a7cc10b 629 'sic_code' => array(
6a488035
TO
630 'name' => 'sic_code',
631 'type' => 2,
632 'title' => 'Sic Code',
633 'maxlength' => 8,
634 'size' => 8,
635 'import' => true,
636 'where' => 'civicrm_contact.sic_code',
b259a4ab 637 'headerPattern' => '/^sic|(s(ic\\s)?code)$/i',
6a488035 638 'export' => true,
89bf81b4 639 'html' => array(
640 'type' => 'Text',
641 ),
6a488035 642 ),
7a7cc10b 643 'user_unique_id' => array(
6a488035
TO
644 'name' => 'user_unique_id',
645 'type' => 2,
646 'title' => 'Unique ID (OpenID)',
647 'maxlength' => 255,
648 'size' => 45,
649 'import' => true,
650 'where' => 'civicrm_contact.user_unique_id',
b259a4ab
EM
651 'headerPattern' => '/^Open\\s?ID|u(niq\\w*)?\\s?ID/i',
652 'dataPattern' => '/^[\\w\\/\\:\\.]+$/',
6a488035
TO
653 'export' => true,
654 'rule' => 'url',
89bf81b4 655 'html' => array(
656 'type' => 'Text',
657 ),
6a488035 658 ),
7a7cc10b 659 'created_date' => array(
6a488035
TO
660 'name' => 'created_date',
661 'type' => 256,
662 'title' => 'Created Date',
663 'required' => '',
89bf81b4 664 'export' => true,
665 'where' => 'civicrm_contact.created_date',
b259a4ab 666 'default' => 'NULL',
6a488035 667 ),
7a7cc10b 668 'modified_date' => array(
6a488035
TO
669 'name' => 'modified_date',
670 'type' => 256,
671 'title' => 'Modified Date',
672 'required' => '',
89bf81b4 673 'export' => true,
674 'where' => 'civicrm_contact.modified_date',
b259a4ab 675 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
6a488035 676 ),
7a7cc10b 677 'source' => array(
6a488035
TO
678 'name' => 'source',
679 'type' => 2,
680 'title' => 'Source of Contact Data',
681 'maxlength' => 255,
682 'size' => 30,
683 'import' => true,
684 'where' => 'civicrm_contact.source',
b259a4ab 685 'headerPattern' => '/(S(ource\\s)?o(f\\s)?C(ontact\\s)?Data)$/i',
6a488035 686 'export' => true,
89bf81b4 687 'html' => array(
688 'type' => 'Text',
689 ),
6a488035
TO
690 'uniqueName' => 'contact_source',
691 ),
7a7cc10b 692 'employer_id' => array(
6a488035
TO
693 'name' => 'employer_id',
694 'type' => 1,
695 'title' => 'Current Employer ID',
696 'export' => true,
697 'where' => 'civicrm_contact.employer_id',
698 'FKClassName' => 'CRM_Contact_DAO_Contact',
89bf81b4 699 'html' => array(
700 'type' => 'Autocomplete-Select',
701 ),
6a488035
TO
702 'uniqueName' => 'current_employer_id',
703 ),
7a7cc10b 704 'is_deleted' => array(
6a488035
TO
705 'name' => 'is_deleted',
706 'type' => 16,
707 'title' => 'Contact is in Trash',
708 'required' => true,
709 'export' => true,
710 'where' => 'civicrm_contact.is_deleted',
89bf81b4 711 'html' => array(
712 'type' => 'CheckBox',
713 ),
6a488035
TO
714 'uniqueName' => 'contact_is_deleted',
715 ),
7a7cc10b 716 'custom_1' => array(
7f6d3dd3 717 'label' => 'Our special field',
6a488035
TO
718 'groupTitle' => 'select_test_g',
719 'data_type' => 'String',
720 'html_type' => 'Select',
b422b715 721 'default_value' => '',
6a488035
TO
722 'text_length' => '',
723 'options_per_line' => '',
724 'custom_group_id' => '1',
725 'extends' => 'Contact',
726 'is_search_range' => 0,
727 'extends_entity_column_value' => '',
728 'extends_entity_column_id' => '',
729 'is_view' => 0,
730 'is_multiple' => 0,
89bf81b4 731 'option_group_id' => '102',
6a488035
TO
732 'date_format' => '',
733 'time_format' => '',
89bf81b4 734 'is_required' => '1',
53ca8fd7 735 'name' => 'custom_1',
89bf81b4 736 'title' => 'Our special field',
3f1a97cd 737 'type' => 2,
7a7cc10b 738 'options' => array(
6a488035
TO
739 '1' => 'Label1',
740 '2' => 'Label2',
741 ),
742 ),
7a7cc10b 743 'current_employer' => array(
6a488035
TO
744 'title' => 'Current Employer',
745 'description' => 'Name of Current Employer',
3f1a97cd 746 'type' => 2,
6a488035 747 ),
7a7cc10b 748 'dupe_check' => array(
749 'title' => 'Check for Duplicates',
750 'description' => 'Throw error if contact create matches dedupe rule',
751 ),
6a488035
TO
752 ),
753);
754
fb32de45 755 return $expectedResult;
6a488035
TO
756}
757
758
759/*
760* This example has been generated from the API test suite. The test that created it is called
761*
762* testCustomFieldCreateWithOptionValues and can be found in
69d79249 763* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
6a488035
TO
764*
765* You can see the outcome of the API tests at
69d79249 766* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
767*
768* To Learn about the API read
69d79249 769* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 770*
69d79249
E
771* Browse the api on your own site with the api explorer
772* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
773*
774* Read more about testing here
775* http://wiki.civicrm.org/confluence/display/CRM/Testing
776*
777* API Standards documentation:
778* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 779*/