API4 - UserJob.get for job_type:label does not return a string
Overview
The pseudoconstant for job_type:label
from UserJob
does not return the label by itself.
Reproduction steps
- Create some user job, e.g. by starting a contact import
- Execute https://dmaster.demo.civicrm.org/civicrm/api4#/explorer/UserJob/get?select=%5B%22job_type:label%22%5D
Current behaviour
Result will be
(1) [
{
"id": 1,
"job_type:label": {
"id": "contact_import",
"name": "contact_import",
"label": "Contact Import",
"class": "CRM_Contact_Import_Parser_Contact"
}
}
]
Side effect: The contact import summary screen will have no title and there is a warning + notice:
Warning: strip_tags() expects parameter 1 to be string, array given in template_preprocess_html() (line 2641 of /opt/buildkit/build/rc/web/includes/theme.inc). Notice: Array to string conversion in include() (line 46 of /opt/buildkit/build/rc/web/themes/garland/page.tpl.php).
Expected behaviour
Result should be
(1) [
{
"id": 1,
"job_type:label": "Contact Import"
}
]
The contact import summary screen will have a proper title.
Comments
I guess that this is a side effect of converting in the user job type entity to string in https://github.com/civicrm/civicrm-core/pull/23888.
PR attempt here: https://github.com/civicrm/civicrm-core/pull/23944