civicrm / org.civicrm.contactlayout

Customize the contact summary screen
Other
15 stars 20 forks source link

Support custom data on optional (combined) entities (eg. Phone) #8

Open mattwire opened 6 years ago

mattwire commented 6 years ago

When creating custom blocks custom data for combined optional entities such as "Phone" is not available to add to the block.

mattwire commented 6 years ago

Seems to track back via core crm.backbone js to here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/BAO/UFGroup.php#L708.

colemanw commented 6 years ago

@mattwire I think there are 2 parts to this:

  1. Do CiviCRM profile forms support these fields at all? After creating a custom block, try editing it the old-school way by going to Administer -> Customize Data & Screens -> Profiles - are you able to add the fields from there? And do they then show up when you view a contact with that block in the summary?
  2. If yes to the above, we need to track down where these fields should be getting added to the backbone model, and add them.
colemanw commented 6 years ago

@mattwire are you able to test the above?

colemanw commented 6 years ago

FYI I tried this out with a custom Address field and found that:

  1. It works perfectly when added to the block via the old-school profile editor.
  2. It works imperfectly when added via the popup profile editor on the layout config page.
    • The custom field does appear.
    • But the "Location type" option is missing, rendering it somewhat broken -- note there is no "(Primary)" following the custom field:

screenshot from 2018-08-15 11-03-17

mattwire commented 6 years ago

Address seems to be a bit of a special case currently. This branch takes a step towards enabling inline custom data for any of the location type entities (eg. Phone, IM etc): https://github.com/mattwire/civicrm-core/tree/inline_customdata

But I don't think it's actually retrieving the value and some work needs to be done in formatUFGroup around this line: $name = "address_{$name}"; to make it actually display the values.