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

dev/core#5587, dev/core#5560 - backport 31455 - restore validation of emails in profiles #31466

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CRM/Core/BAO/UFGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ protected static function formatUFField(
'help_post' => $field->help_post,
'visibility' => $field->visibility,
'in_selector' => $field->in_selector,
// In core I believe "rule" will never exist anymore in $importableFields since 5.75, but see farther down where it gets set for some input_types.
'rule' => $importableFields[$field->field_name]['rule'] ?? NULL,
'location_type_id' => $field->location_type_id ?? NULL,
'website_type_id' => $field->website_type_id ?? NULL,
Expand All @@ -484,6 +485,20 @@ protected static function formatUFField(
'html_type' => $fieldMetaData['html']['type'] ?? NULL,
];

// "rule" used to come from the xml schema, but now we fall back to basing it on the html_type.
// It's used for example in buildProfile to add a form rule.
if (empty($formattedField['rule'])) {
switch ($formattedField['html_type']) {
case 'Email':
$formattedField['rule'] = 'email';
break;

case 'Url':
$formattedField['rule'] = 'url';
break;
}
}

$formattedField = CRM_Utils_Date::addDateMetadataToField($fieldMetaData, $formattedField);

//adding custom field property
Expand Down