ExtendedFieldComparator.php in Changed Fields API 8.3
File
examples/changed_fields_extended_field_comparator/src/Plugin/FieldComparator/ExtendedFieldComparator.php
View source
<?php
namespace Drupal\changed_fields_extended_field_comparator\Plugin\FieldComparator;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\changed_fields\Plugin\FieldComparator\DefaultFieldComparator;
class ExtendedFieldComparator extends DefaultFieldComparator {
public function getDefaultComparableProperties(FieldDefinitionInterface $field_definition) {
$properties = [];
if ($field_definition
->getType() == 'some_field_type') {
$properties = [
'some_field_property_1',
'some_field_property_2',
];
}
return $properties;
}
public function extendComparableProperties(FieldDefinitionInterface $field_definition, array $properties) {
if ($field_definition
->getType() == 'some_field_type') {
$properties[] = 'some_field_property_3';
}
return $properties;
}
}