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

Expose field label to APIv4 and Search creaor #18255

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

colemanw
Copy link
Member

Overview

This is another step to codify the difference between a field's title and label in the schema.
It exposes labels to APIv4 and switches over to using labels in the new Search extension.

It also attempts to clarify the difference between titles and labels in the getfields description:

  • title: "Technical name of field, shown in API and exports"
  • label: "User-facing label, shown on most forms and displays"

Comments

This continues in the same direction as #18114 but after merging this there's still more cleanup to do in the schema, fixing titles to be more technical and less "label-ey" and adding labels where they are missing (which is nearly everywhere).

@civibot
Copy link

civibot bot commented Aug 25, 2020

(Standard links)

@civibot civibot bot added the master label Aug 25, 2020
colemanw added a commit to colemanw/civicrm-core that referenced this pull request Aug 25, 2020
Follow-up to civicrm#18255 and civicrm#18114 - this separates field titles (used in export) from labels (used in forms and other displays).
The previous approach was to try to use the title for both, and if that didn't work, override it somewhere.
@eileenmcnaughton
Copy link
Contributor

test fail unrelated

@eileenmcnaughton
Copy link
Contributor

@colemanw I'm merging this but we should think about whether we also want to include the option group label in the mix. We could load the label from the option_group.label in a lot of cases - this

  1. reduces the places we need to define & uses existing metadata
  2. I think it's a good think that it could be altered at a site level (although tangental)

@eileenmcnaughton eileenmcnaughton merged commit fa8d7c0 into civicrm:master Aug 25, 2020
@eileenmcnaughton eileenmcnaughton deleted the fieldLabel branch August 25, 2020 20:30
@colemanw
Copy link
Member Author

So you're suggesting that for fields with a pseudoconstant which happens to be be stored in the option_value table, we could use the option_group.label instead of field.html.label?

That doesn't feel like a very complrehensive solution to me, because there are so many fields that either don't have pseuodoconstants or if they do, the options are not stored in that table. Also, what about when multiple fields share the same option_group - wouldn't we want the field label to take precidence?

My other objection (which could be overcome with good documentation) is that for someone trying to grok how our form layer works, the field label would seem to appear by magic with no idea where it's coming from.

@eileenmcnaughton
Copy link
Contributor

@colemanw I think to make it work the getFields would need to populate ['html']['label'] for the field, when possible - for labels only

But, I hadn't considered there might be more than one field using the same option group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants