Skip to content

Instantly share code, notes, and snippets.

@colemanw
Created January 16, 2016 01:55
Show Gist options
  • Save colemanw/577dfbca79fab34f312b to your computer and use it in GitHub Desktop.
Save colemanw/577dfbca79fab34f312b to your computer and use it in GitHub Desktop.
diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php
index 86c211a..a6f417b 100644
--- a/CRM/Core/CodeGen/Specification.php
+++ b/CRM/Core/CodeGen/Specification.php
@@ -416,6 +416,8 @@ class CRM_Core_CodeGen_Specification {
'callback',
// Path to options edit form
'optionEditPath',
+ // A simple list of options. I miss enum fields...
+ 'options',
);
foreach ($validOptions as $pseudoOption) {
if (!empty($fieldXML->pseudoconstant->$pseudoOption)) {
diff --git a/xml/schema/Core/Note.xml b/xml/schema/Core/Note.xml
index 128da77..1199fb7 100644
--- a/xml/schema/Core/Note.xml
+++ b/xml/schema/Core/Note.xml
@@ -26,6 +26,14 @@
<length>64</length>
<required>true</required>
<comment>Name of table where item being referenced is stored.</comment>
+ <pseudoconstant>
+ <options>
+ <option key="civicrm_relationship">Relationship</option>
+ <option>civicrm_contact</option>
+ <option>civicrm_participant</option>
+ <option>civicrm_contribution</option>
+ </options>
+ </pseudoconstant>
<add>1.1</add>
</field>
<field>
@colemanw
Copy link
Author

Note that options could be key=>value pairs, or if no key is specified then the value would be used as a key.
Obviously there's more code to write to make that all happen...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment