Extension breaks formatting / layout of profile editor page
Created by: webmaster-cses-org-uk
When extension is enabled, the tabbed layout of the CiviCRM Profiles page is broken.
This is because the extension overrides CRM_UF_Page_Group and CRM_UF_Page_ProfileEditor, but the bundled files are out-of-date.
CRM_UF_Page_Group is missing the following section at line 365 of civicrm-core/CRM/UF/Page/Group.php:
Civi::resources()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
->addSetting([
'tabSettings' => ['active' => $_GET['selectedChild'] ?? NULL],
]);
This file needs to be updated to the latest version, but it would be better if a long-term solution could be found that doesn't involve replacing one of the core files. Possibly one of:
- Make grant_type a pseudoconstant and update core version accordingly (would need agreement from core maintainers).
- Use a template hook to populate just the specific part of the table, leaving the rest of the page as default.
It is no longer necessary to override CRM_UF_Page_ProfileEditor as the core version now includes support for other entities by pattern matching (see line 194 of civicrm-core/CRM/UF/Page/ProfileEditor.php):
default:
if (strpos($entityType, 'Model') !== FALSE) {
$entity = str_replace('Model', '', $entityType);
$backboneModel = self::convertCiviModelToBackboneModel(
$entity,
ts('%1', [1 => $entity]),
$availableFields
);
if (!empty($backboneModel['schema'])) {
$civiSchema[$entityType] = $backboneModel;
}
}
if (!isset($civiSchema[$entityType])) {
throw new CRM_Core_Exception("Unrecognized entity type: $entityType");
}
Suggest that this file be removed from the extension.
The purpose of the override of CRM/Core/Page/AJAX/Location.php (adding "File" to the list of options when calculating field defaults) is unclear? This seems to be in-date, however.