-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Towards CRM-21140, support at api level for custom data on any entity. #11567
Conversation
This extends the ability to support additional entities for custom data by adding them to the OptionGroup 'cg_extends'. At this stage there are 2 additional tested (supported) entities - UFGroup, PriceSet, PaymentToken. Will add more next iteration
0299a74
to
3fb8828
Compare
@MegaphoneJon - any chance you can review this? It's actually a pretty trivial change due to past clean up we have done |
Yes, I had my eye on it! I've been slammed but I have a need for this, so I'll make some time in the next couple of days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I was even able to test this through the UI with a little bit of trickery, using an entity not covered by the unit tests. I feel good about this.
(CiviCRM Review Template DEL-1.0)
|
@colemanw are you ok to merge this based on @MegaphoneJon review. Re additional entities - I do plan to chip away at adding them to the unit tests & confirm which others do / don't work. I specifically know the mailing api needs some clean up first (because it does weird stuff with the deprecated $ids parameter. I will follow up with the docs pr once this is merged |
@colemanw - there is no intention at this stage to expose the new options through the UI - that can be up to extension writers to do that as they add functionality. Regarding the BAO vs api - I think it would be ideal to consolidate on the api but this approach succeeds in at least not doubling up - ie. where it is already through the BAO we are not doing it twice since we have an array of those entities. It's hard to remove from the BAO without ensuring there are no places relying on it |
How would an extension go about altering that UI? My assumption as a developer would be that adding an entity to that option group would also add it to the list in the UI, but if there is another relatively straightforward way of doing it, ok. |
Actually I guess that UI might pick it up - I'm not sure how it builds it - at this stage I'm focussed on the scenario where developers want to create additional custom fields against entities in extensions - rather than allowing people to add them themselves. I guess if an entity is enabled for custom data & that entity happens to be enabled in the UI then it's probably OK - but I wouldn't have tried to add that purposely at this stage. I think stage one is that developers can add custom fields against any entity, including ones that they create themselves. |
To respond to the question above: Any entities added to the In fact, during my testing I created custom fields for FinancialType records entirely from the UI. I needed the API to populate/read the values of course - but I was able to extend custom fields to a new entity without the API. |
Ok, very cool. |
Overview
This extends the ability to support additional entities for custom data by
adding them to the OptionGroup 'cg_extends'. At this stage there
are 2 additional tested (supported) entities - UFGroup, PriceSet, PaymentToken.
Note this 'feature' is expected to be available for the March release (5.0.0.0 I think) so that extension writers can target 5.x for custom data on any entity. This is just progress towards that goal
Will add more next iteration
Before
Not possible to extend entities for custom data outside hard-coded core ones.
After
UFGroup, PriceSet, PaymentToken now possible & tested/supported.
Technical Details
Comments
I will follow up with the next ones I can test later