Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5.8
-
Fix Version/s: 4.7.5
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:Developer Doc
Description
We discussed the possibility to add an addfield method.
Coming from https://github.com/civicrm/civicrm-core/pull/5419
The fn signature would be pretty much the same as addSelect
After resolving the $entity and $field it would call civicrm_api3($entity, 'getfields') to load the field's metadata (aside, maybe we need to add an api "getfield" action to make it easier to fetch a single field).
Depending on the html type it would call CRM_Core_Form::add with appropriate options.
Once implemented I think all calls to addSelect could be swapped for addField and probably that function could be deleted.
A first step could be to implement the function, and change one form to use this method as much as possible.