function _remove_duplicates_get_field_common_name in Remove Duplicates 7
Get the field common name used in node objects.
Parameters
string $node_field_machine_name: The {field} used to group nodes and therefore create sets of duplicate nodes.
Return value
string A field name to use with extracted db records
4 calls to _remove_duplicates_get_field_common_name()
- _remove_duplicates_get_duplicate_node_groups in ./
remove_duplicates.module - Get all duplicate node grouped according to selected field.
- _remove_duplicates_get_list_output in ./
remove_duplicates.module - Get a list themed output (Legacy output).
- _remove_duplicates_get_tableselect_output in ./
remove_duplicates.module - Get a tableselect data output.
- _remove_duplicates_get_table_output in ./
remove_duplicates.module - Get a table themed output (Legacy output).
File
- ./
remove_duplicates.module, line 637 - Remove duplicate nodes according to node fields or Custom fields.
Code
function _remove_duplicates_get_field_common_name($node_field_machine_name) {
if (in_array(strtolower($node_field_machine_name), array(
'title',
))) {
// Basic field.
$field = $node_field_machine_name;
}
else {
// Custom field.
$field_info = field_info_field($node_field_machine_name);
if (!empty($field_info['storage']['details']['sql']['FIELD_LOAD_CURRENT'])) {
$table = key($field_info['storage']['details']['sql']['FIELD_LOAD_CURRENT']);
$field = current($field_info['storage']['details']['sql']['FIELD_LOAD_CURRENT'][$table]);
if (!(db_table_exists($table) && db_field_exists($table, $field))) {
return NULL;
}
}
else {
return NULL;
}
}
return $field;
}