Skip to content
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

SearchKit - Support conditional links #22557

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

colemanw
Copy link
Member

Overview

Advanced feature to conditionally show/hide links in a links/buttons/menu column, based on user permissions or row values.

Before

Links would display unconditionally.

After

Links can be hidden based on user permissions (e.g. "access CiviCase") or according to a value (e.g. is_active = TRUE).

@civibot
Copy link

civibot bot commented Jan 18, 2022

(Standard links)

@civibot civibot bot added the master label Jan 18, 2022
@colemanw colemanw force-pushed the searckKitLinkConditions branch from 120b1e4 to a8bb32c Compare January 18, 2022 02:47
@eileenmcnaughton
Copy link
Contributor

@colemanw in trying to test this PR I hit a possible recent regression - going to this page

http://core-22557-5o32p.test-3.civicrm.org:8001/civicrm/acl/entityrole?action=update&id=2

And attempting to save I get this

image

My understanding is that the CRM_Core_BAO_Managed::on_hook_civicrm_post function should only be called on the Managed entity - but here it is responding to the entity role

image

@colemanw
Copy link
Member Author

@eileenmcnaughton it always responds to the hook (because that's the only way to implement a hook) but then decides to act based on the entity name. Why on earth is entity = null in that event? That's the problem.

@eileenmcnaughton
Copy link
Contributor

@colemanw yeah that is fixed now - so I can try again to replicate this

@colemanw colemanw force-pushed the searckKitLinkConditions branch from a8bb32c to 8f40366 Compare January 21, 2022 01:11
@eileenmcnaughton
Copy link
Contributor

@colemanw did you make more changes? I just tested this - it took me a bit to figure out what it was doing but once it did I added some docs

https://lab.civicrm.org/documentation/docs/user-en/-/merge_requests/548

The only 'issue' (more like a feature gap) I noticed is that for tokens I can use fields not in the display but for the conditional links I can't. What I tried to do was add a link on the email field to the url

civicrm/activity/email/add?action=add&reset=1&selectedChild=activity&atype=3&email_id=[Contact_Email_contact_id_01.id]

but only if the on_hold field - which is not in the display = 0

Also side-issue - that url if kind of a hidden url (since normally cid rather than email id is used) but I think it would be good to define as a link in the email entity - we do define non-crud links?

@colemanw
Copy link
Member Author

colemanw commented Jan 21, 2022

Thanks for the review @eileenmcnaughton. The change I made was to take your code style suggestions.
Yes I kept the code simpler and avoided making myself crazy by only supporting fields in the SELECT clause in these conditions.

Advanced feature to conditionally show/hide links in a links/buttons/menu column,
based on user permissions or row values.
@colemanw colemanw force-pushed the searckKitLinkConditions branch from 8f40366 to 8349890 Compare January 21, 2022 02:14
@seamuslee001 seamuslee001 merged commit 9008e41 into civicrm:master Jan 21, 2022
@seamuslee001 seamuslee001 deleted the searckKitLinkConditions branch January 21, 2022 06:46
agileware-justin pushed a commit to agileware/civicrm-end-user-guide that referenced this pull request Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants