Creating separate issue, since #857258 has been attributed to FileFiled module.

I have a node type with one common filefield for uploading both media (audio, video) and image files. I wanted to create a block displaying only three random nodes which has only files of image types. In order to do that I created Node type view with 'Content: Photo twi75 image linked to node' field. It spits out results (3 nodes in my case) correctly linked to their respective nodes. However, I can't filter out nodes only containing images according to mimetype since Views of node type do not provide any options for File related filters.

There is no option to maintain relationships in Node type views with files attached with filefield. There is an option in filters for Content: Photo, Audio or Video (field_file) - list, which enables filtering out nodes which have any contents in filefields with no possibility of checking their mimetype. (Probably, need to create separate feature request for this, but here I am trying to deal with the initial problem of File type Views not being able to linke its Fields to the respective nodes)

$view = new view;
$view->name = 'vianode';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 3.0-alpha1;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '3';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['columns'] = '3';
$handler->display->display_options['style_options']['fill_single_line'] = 1;
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Content: Photo, Audio or Video (field_file) */
$handler->display->display_options['fields']['field_file_fid']['id'] = 'field_file_fid';
$handler->display->display_options['fields']['field_file_fid']['table'] = 'node_data_field_file';
$handler->display->display_options['fields']['field_file_fid']['field'] = 'field_file_fid';
$handler->display->display_options['fields']['field_file_fid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_file_fid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_file_fid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_file_fid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_file_fid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_file_fid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_file_fid']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_file_fid']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_file_fid']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_file_fid']['link_to_node'] = 0;
$handler->display->display_options['fields']['field_file_fid']['label_type'] = 'none';
$handler->display->display_options['fields']['field_file_fid']['format'] = 'twi75_linked';
/* Sort criterion: Global: Random */
$handler->display->display_options['sorts']['random']['id'] = 'random';
$handler->display->display_options['sorts']['random']['table'] = 'views';
$handler->display->display_options['sorts']['random']['field'] = 'random';

Comments

dawehner’s picture

Even if this belongs to the filefield issue queue, it's already possible.

Therefore add a relationship for this field. The name of the relationship is the name of the field.

yngens’s picture

Status: Active » Closed (fixed)

Ah, I don't know how I did not try that way. Works like a charm, thank you very much for pointing out right directions.
Now, I hope related issue for filefield will be solved #857258: 'Image linked to node' in Fields does not link to node in File view type. Closing the issue.