SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | // APPROACH A: One magical entity | |
4 | ||
5 | // CRUD for domain-level settings; 'id' means domain_id in all actions | |
6 | civicrm_api('Setting','create', array( | |
7 | 'id' => $ // optional if single-domain; mandatory for multiple domain | |
8 | 'timezone' => $, | |
9 | )); | |
10 | // CRUD for contact-level settings; 'id' is not used | |
11 | civicrm_api('Setting','create', array( | |
12 | 'contact_id' => $ // optional; default current user | |
13 | 'timezone' => $, | |
14 | )); | |
15 | // R for settings | |
16 | civicrm_api('Setting', 'resolve', array( | |
17 | return => 'timezone', | |
18 | )); | |
19 | ||
20 | // APPROACH B: Three (somewhat) magical entities | |
21 | ||
22 | // CRUD for domain-level settings; 'id' means domain_id in all actions | |
23 | civicrm_api('DomainSetting','create', array( | |
24 | 'id' => $ // optional if single-domain; mandatory for multiple domain | |
25 | 'timezone' => $, | |
26 | )); | |
27 | - | // CRUD for contact-level settings; 'id' means domain_id in all actions |
27 | + | // CRUD for contact-level settings; 'id' means contact_id in all actions |
28 | civicrm_api('ContactSetting','create', array( | |
29 | 'id' => $ // optional; default current user | |
30 | 'timezone' => $, | |
31 | )); | |
32 | // R for settings | |
33 | civicrm_api('Setting', 'get', array( | |
34 | return => 'timezone', | |
35 | )); |