civicrm / org.civicrm.civicase

CiviCase Extension
Other
9 stars 35 forks source link

CATL-939: Api to Change Case Dashboard Table Structure #93

Closed MiyaNoctem closed 6 years ago

MiyaNoctem commented 6 years ago

Overview

We need to be able to use a hook to modify which columns to display in the table view, add new columns or alter content. On the case tab of the contact record or in the case dashboard, we want to allow a developer to "hook in" additional fields and information related to that case. This could be:

From a UI perspective, once the developer applies this hook, they should be able to see the changes (new columns/reduced columns/edited columns etc) in the case tab of a contact record or the case dashboard.

Before

Columns to be shown in case dashboard were hardcoded in the angular template being used to render the html.

After

  1. Added a new API action gettablesummary call that builds a paginated list of cases, plus a list of columns or headers that should be visible on the table.
  2. Edited the template for the case dashboard table so the columns shown are determined dynamically from the list of headers passed by the API call to gettablesummary action.

Comments

To change the contents and/or allowed headers of the case list tables, you can use the APIWrappers hook, which is built into all CiviCRM API calls.

colemanw commented 6 years ago

Since you are using the api I think adding a new hook may be overkill. Every api is automatically hookable via hook_civicrm_apiWrappers. Can you try that first before adding this new hook and see if it works for you?

MiyaNoctem commented 6 years ago

Hey @colemanw,

You're absolutely right, using apiWrappers would do the trick. Thanks for pointing it out! I'll get rid of the hooks.

MiyaNoctem commented 6 years ago

Hey @colemanw,

Can you give a final look at this PR, to see if we can merge?

Thanks!