Commit b7d5f8cd authored by quicksketch's avatar quicksketch

#735608 by infojunkie: Add relationship to the Node table based on FileField tables.

parent 6877d63b
......@@ -76,6 +76,7 @@ function filefield_field_settings_views_data($field) {
'handler' => 'content_handler_relationship',
'label' => t($field['widget']['label']),
'content_field_name' => $field['field_name'],
'skip base' => array('files'),
);
// Use the Views boolean handler for filtering the list value.
......@@ -98,6 +99,25 @@ function filefield_field_settings_views_data($field) {
unset($data[$table_alias][$field['field_name'] .'_data']['argument']);
unset($data[$table_alias][$field['field_name'] .'_list']['argument']);
// Set up relationship with file views.
$data[$table_alias]['table']['join']['files'] = array(
'table' => $db_info['table'],
'left_field' => 'fid',
'field' => $db_info['columns']['fid']['column'],
);
$data[$table_alias]['vid'] = array(
'title' => t($field['widget']['label']),
'help' => t('The node the uploaded file is attached to'),
'relationship' => array(
'label' => t($field['widget']['label']),
'base' => 'node',
'base field' => 'vid',
// This allows us to not show this relationship if the base is already
// node so users won't create circular relationships.
'skip base' => array('node', 'node_revisions'),
),
);
return $data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment