-
-
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
[NFC] Add EntityFormTrait to pricefieldForm - standardised getEntityId() #17516
Conversation
This is an alternative to https://github.com/civicrm/civicrm-core/pull/17514/files Really we want to use a standardised way to get the entity id from an edit form & _fid is kinda wierd
(Standard links)
|
I definitely like the cleaner code and potential for eventual cleanup :) Question: In order to save the Entity ID for the postProcess hook, do we also have to implement/override Test fails seem unrelated:
|
jenkins, test this please |
test this please |
@mlutfy it would be nice to get rid of $_fid in favour of $_id but at this stage it should work because the preProcess does
Note that calling retrieve like that also does
On submit it passes through that line again & if it is no longer in the url then it gets it from the So it should all work without an extra setEntityId() |
test this please |
Jenkins re test this please |
@eileenmcnaughton It didn't seem to work for me in a postProcess hook, i.e. the "id" was not available in the params passed to the hook (when adding new price fields, it was OK when editing an existing PF). I had to add this at the end of postProcess:
although happy to merge this, and continue the discussion separately, since it's a good NFC cleanup. |
@mlutfy ok - let's merge & check - that makes sense |
Overview
This is an alternative to https://github.com/civicrm/civicrm-core/pull/17514/files
Really we want to use a standardised way to get the entity id from an edit form
& _fid is kinda wierd
Before
No clear way to retrieve the entity id from PriceFieldForm
After
It uses the EntityFormTrait & like other forms that do the public function getEntityId() is availablle.
Technical Details
Other tidy up changes - use getEntityId() internally on the form. Add functions required to support inclusion of entity form trait, don't pass default parameters to CRM_Utils_Request::retrieve.
Comments
Note that this does not convert fully to the entity form which would reduce code, declare fields by metadata, support defaults in url & support custom field on the entity