protected function FieldComparatorManager::getOrderedFieldComparators in Conflict 8.2
Returns the field comparators.
Parameters
string $entity_type_id: The entity type ID.
string $bundle: The entity bundle ID.
string $field_type: The field type.
string $field_name: The field name.
Return value
array The field comparators.
2 calls to FieldComparatorManager::getOrderedFieldComparators()
- FieldComparatorManager::getConflictType in src/
FieldComparatorManager.php - Returns the conflict type for a field.
- FieldComparatorManager::hasChanged in src/
FieldComparatorManager.php - Compares two field item lists.
File
- src/
FieldComparatorManager.php, line 106
Class
Namespace
Drupal\conflictCode
protected function getOrderedFieldComparators($entity_type_id, $bundle, $field_type, $field_name) {
if (isset($this->orderedFieldComparators[$entity_type_id][$bundle][$field_type][$field_name])) {
return $this->orderedFieldComparators[$entity_type_id][$bundle][$field_type][$field_name];
}
$this
->initFieldComparators();
$generic = FieldComparatorInterface::APPLIES_TO_ALL;
$comparators = [];
// Entity type - specific.
// Bundle - specific.
// Field type - specific.
// Field name - specific.
$comparators += $this->fieldComparators[$entity_type_id][$bundle][$field_type][$field_name]['comparators'] ?? [];
// Entity type - specific.
// Bundle - specific.
// Field type - specific.
// Field name - all.
$comparators += $this->fieldComparators[$entity_type_id][$bundle][$field_type][$generic]['comparators'] ?? [];
// Entity type - specific.
// Bundle - all.
// Field type - specific.
// Field name - all.
$comparators += $this->fieldComparators[$entity_type_id][$generic][$field_type][$generic]['comparators'] ?? [];
// Entity type - specific.
// Bundle - all.
// Field type - specific.
// Field name - specific.
$comparators += $this->fieldComparators[$entity_type_id][$generic][$field_type][$field_name]['comparators'] ?? [];
// Entity type - specific.
// Bundle - all.
// Field type - all.
// Field name - all.
$comparators += $this->fieldComparators[$entity_type_id][$generic][$generic][$generic]['comparators'] ?? [];
// Entity type - all.
// Bundle - all.
// Field type - specific.
// Field name - all.
$comparators += $this->fieldComparators[$generic][$generic][$field_type][$generic]['comparators'] ?? [];
// Entity type - all.
// Bundle - all.
// Field type - all.
// Field name - all.
$comparators += $this->fieldComparators[$generic][$generic][$generic][$generic]['comparators'] ?? [];
if (empty($comparators)) {
throw new \Exception('There are no field comparators available.');
}
$this->orderedFieldComparators[$entity_type_id][$bundle][$field_type][$field_name] = $comparators;
return $comparators;
}