-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
afform - add dynamic forms for creating/update custom group data #31484
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
@colemanw just putting this up as WIP on the custom group afforms. Started on the create/update forms as they are a bit simpler, but have made some in-roads into the search listings too. Got a bit bogged down in I wondered about just using an afform with a url to add the tabs directly, rather than via the afform placement tag? e.g. the following basically seemed to work
I got got by the contact summary seemingly force the url to begin /civicrm/contact , so not happy with a generic url for a listing that works to any custom group (I had /civicrm/af/custom/GROUPNAME/list ). |
* - a submission form for adding a new Custom record to a parent entity record | ||
* - a submission form for editing a particular Custom record |
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.
I think these 2 could be the same form actually.
entity_id
could be a hidden field passed through the url.
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.
ah yes I see what you mean, good point
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.
I've kept separate forms - I think it makes sense that there's a clear route for the Create action vs Update - because entity_id
is required for the former, but can be derived from the id
(ie the custom record id) in the latter case.
Whilst at this point the entity_id is hidden on both forms, I would like to keep open the door for the entity_id
being shown in future - probably readonly on the Update form; and potentially as an EntityRef select on the Create form.
I have combined the smarty templates for now though.
I don't think you need to reinvent the wheel here. I can answer your questions about |
ac868b3
to
6810ead
Compare
add dynamic forms for editing and adding custom group data
6810ead
to
80ed4e0
Compare
I've got it working... though with a small hack, because the pre-existing custom tabs use the CustomGroup id, and I would really like the afforms to use CustomGroup name. |
I think is ready for review now. Follow up coming with the tabs bit... |
@ufundo I started reviewing this on the demo site & created a multi-record custom set & enabled the civicrm_admin_ui module but the tab on the contact summary screen remained the same. I must have misread your comment about a hack to change the existing custom tab, I thought you'd done it already. But here's an interesting tidbit. When you use the old tab to create a new custom record, you see this: So I guess that answers the question of "how did we get here?" - the old multi-record custom form triggers it. All the more reason to get rid of it. And another interesting tidbit for you: if you didn't see it already, creating an Afform with the same name as a contact summary tab automatically replaces that tab, no need to do anything with |
Overview
Currently afform blocks are auto generated for custom group data, which you can add to your own forms.
This adds automatic forms which can be used to edit the custom group data.
Comments
I've moved the form generation from the Afform/Get class to a dedicated action on CustomGroup entity, as it gets a bit more involved creating multiple forms for each Group.
Still a bit WIP.
Questions:
entity_id
field).civicrm_admin_ui
, because there are a bit more involvedNext step: