private function CFDefaultFieldComparator::getComparableProperties in Changed Fields API 7.3
Same name and namespace in other branches
- 7 includes/changed_fields.core.inc \CFDefaultFieldComparator::getComparableProperties()
- 7.2 includes/changed_fields.core.inc \CFDefaultFieldComparator::getComparableProperties()
Method that returns comparable properties for existing field type.
Parameters
array $fieldInfo: Array contains field instance and field base information.
Return value
array Array with properties that we need to use to compare two field values.
1 call to CFDefaultFieldComparator::getComparableProperties()
- CFDefaultFieldComparator::compareFieldValues in src/
FieldComparator/ CFDefaultFieldComparator.php - Method that compares old and new field values.
File
- src/
FieldComparator/ CFDefaultFieldComparator.php, line 84
Class
- CFDefaultFieldComparator
- Class CFDefaultFieldComparator.
Code
private function getComparableProperties(array $fieldInfo) {
switch ($fieldInfo['field_base']['type']) {
case 'text_with_summary':
$properties = [
'value',
'summary',
'format',
];
break;
case 'text':
case 'text_long':
case 'number_decimal':
case 'number_float':
case 'number_integer':
case 'list_float':
case 'list_integer':
case 'list_boolean':
case 'list_text':
case 'phone':
$properties = [
'value',
];
break;
case 'taxonomy_term_reference':
$properties = [
'tid',
];
break;
case 'entityreference':
$properties = [
'target_id',
];
break;
case 'image':
$properties = [
'fid',
'width',
'height',
];
if (!empty($fieldInfo['field_instance']['settings']['alt_field'])) {
$properties[] = 'alt';
}
if (!empty($fieldInfo['field_instance']['settings']['title_field'])) {
$properties[] = 'title';
}
break;
case 'file':
$properties = [
'fid',
];
if (!empty($fieldInfo['field_instance']['settings']['description_field'])) {
$properties[] = 'description';
}
if (!empty($fieldInfo['field_instance']['settings']['display_field'])) {
$properties[] = 'display';
}
break;
case 'date':
case 'datetime':
case 'datestamp':
$properties = [
'value',
'timezone',
];
break;
case 'email':
$properties = [
'email',
];
break;
case 'link_field':
$properties = [
'url',
'title',
];
break;
default:
$properties = $this
->getDefaultComparableProperties($fieldInfo);
break;
}
return $this
->extendComparableProperties($fieldInfo, $properties);
}