CiviCRM cheatsheet » History » Version 2
Brienne Kordis, 10/12/2022 07:27 PM
| 1 | 1 | Brienne Kordis | # CiviCRM cheatsheet |
|---|---|---|---|
| 2 | |||
| 3 | ### Custom Entities & Extensions |
||
| 4 | * A new Entity (think: Contact, Event) can be added to CiviCRM via an extension |
||
| 5 | * use the `civix` [commands](https://docs.civicrm.org/dev/en/latest/extensions/civix/) to create the extension. |
||
| 6 | * To create core fields on the new extension, edit the XML file of the extension. Reference this [guide](https://docs.civicrm.org/dev/en/latest/framework/database/schema-definition/) for the options. |
||
| 7 | * To add custom fields on the new extension, follow this [guide](https://docs.civicrm.org/dev/en/latest/step-by-step/create-entity/#121-making-our-entity-available-for-custom-data). It is also helpful to read about [managed entities](https://docs.civicrm.org/dev/en/latest/api/v4/managed/) before tackling custom fields. |
||
| 8 | * You can include configured Search Kit searches and Form Builder forms in your extension. |
||
| 9 | 2 | Brienne Kordis | * _Search Kit_ |
| 10 | 1 | Brienne Kordis | * Create, configure, and save your search and any desired displays |
| 11 | * Go to **Support > Developer > API Explorer v4** |
||
| 12 | * Set the Entity to *Saved Search* and the Action to *export* (You will need the id of the saved search, so if unknown, do a *get* first) |
||
| 13 | * Fill in the id of the saved search and click **Execute** |
||
| 14 | * On the upper right corner of the results box, change *View as JSON* to *View as PHP* |
||
| 15 | * Copy the results |
||
| 16 | * Paste the results in a new file named `SavedSearch_name-of-saved-search.mgd.php` within the *managed* folder within the particular extension's folder. Note that you might need to create the *managed* folder as `civix` does not generate it automatically, but if you created custom fields as noted above, then you will have already added it. Also make sure that you add `<?php` to the top of the file! |
||
| 17 | 2 | Brienne Kordis | * _Form Builder_ |
| 18 | 1 | Brienne Kordis | * Create, configure, and save your forms |
| 19 | * In the root folder of your extension, create an *ang* folder if it does not yet exist |
||
| 20 | * Move the files (both the html and json) related to your form(s) from their default location into the ang folder of your extension |
||
| 21 | * The default location, such as for WordPress sites is `/wp-content/uploads/civicrm/ang` |